@@ -540,46 +540,48 @@ vec3d *vm_vec_perp(vec3d *dest, const vec3d *p0, const vec3d *p1,const vec3d *p2
540540
541541// computes the delta angle between two vectors.
542542// vectors need not be normalized. if they are, call vm_vec_delta_ang_norm()
543- // the forward vector (third parameter) can be NULL, in which case the absolute
544- // value of the angle in returned. Otherwise the angle around that vector is
545- // returned.
546- float vm_vec_delta_ang (const vec3d *v0, const vec3d *v1, const vec3d *fvec)
543+ // the up vector (third parameter) can be NULL, in which case the absolute
544+ // value of the angle in returned.
545+ // Otherwise, the delta ang will be positive if the v0 -> v1 direction from the
546+ // point of view of uvec is clockwise, negative if counterclockwise.
547+ // This vector should be orthogonal to v0 and v1
548+ float vm_vec_delta_ang (const vec3d *v0, const vec3d *v1, const vec3d *uvec)
547549{
548550 float t;
549551 vec3d t0,t1,t2;
550552
551553 vm_vec_copy_normalize (&t0,v0);
552554 vm_vec_copy_normalize (&t1,v1);
553555
554- if (NULL == fvec ) {
556+ if (uvec == nullptr ) {
555557 t = vm_vec_delta_ang_norm (&t0, &t1, NULL );
556558 } else {
557- vm_vec_copy_normalize (&t2,fvec );
559+ vm_vec_copy_normalize (&t2,uvec );
558560 t = vm_vec_delta_ang_norm (&t0,&t1,&t2);
559561 }
560562
561563 return t;
562564}
563565
564566// computes the delta angle between two normalized vectors.
565- float vm_vec_delta_ang_norm (const vec3d *v0, const vec3d *v1, const vec3d *fvec )
567+ float vm_vec_delta_ang_norm (const vec3d *v0, const vec3d *v1, const vec3d *uvec )
566568{
567569 float a;
568570 vec3d t;
569571
570572 a = acosf (vm_vec_dot (v0,v1));
571573
572- if (fvec ) {
574+ if (uvec ) {
573575 vm_vec_cross (&t,v0,v1);
574- if ( vm_vec_dot (&t,fvec ) < 0.0 ) {
576+ if ( vm_vec_dot (&t,uvec ) < 0.0 ) {
575577 a = -a;
576578 }
577579 }
578580
579581 return a;
580582}
581583
582- float vm_vec_delta_ang_norm_safe (const vec3d *v0, const vec3d *v1, const vec3d *fvec )
584+ float vm_vec_delta_ang_norm_safe (const vec3d *v0, const vec3d *v1, const vec3d *uvec )
583585{
584586 float a, dot;
585587 vec3d t;
@@ -591,9 +593,9 @@ float vm_vec_delta_ang_norm_safe(const vec3d *v0, const vec3d *v1, const vec3d *
591593
592594 a = acosf (dot);
593595
594- if (fvec ) {
596+ if (uvec ) {
595597 vm_vec_cross (&t,v0,v1);
596- if ( vm_vec_dot (&t,fvec ) < 0.0 ) {
598+ if ( vm_vec_dot (&t,uvec ) < 0.0 ) {
597599 a = -a;
598600 }
599601 }
0 commit comments