Fixed addauxref for the triple axis code
Added a writing state to status
This commit is contained in:
31
vector.c
31
vector.c
@ -189,6 +189,37 @@ double angleBetween(MATRIX v1, MATRIX v2)
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
angleBetween gives only angles between 0 - 180. This is also the
|
||||
only thing there is; the direction of the rotation depends on the
|
||||
viewpoint and thus is ill defined. This version determines the
|
||||
sign of the rotation from v3[2]. I made a special version in order not
|
||||
to trouble other uses of angleBetween.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
double tasAngleBetween(MATRIX v1, MATRIX v2)
|
||||
{
|
||||
double angle, angles, sum;
|
||||
MATRIX v3 = NULL;
|
||||
int i;
|
||||
|
||||
angle = vectorDotProduct(v1, v2) / (vectorLength(v1) * vectorLength(v2));
|
||||
v3 = vectorCrossProduct(v1, v2);
|
||||
if (v3 != NULL) {
|
||||
angles = vectorLength(v3) / (vectorLength(v1) * vectorLength(v2));
|
||||
angle = Atan2d(angles, angle);
|
||||
for(i = 0, sum = .0; i < 3; i++){
|
||||
sum += v3[i][0];
|
||||
}
|
||||
if(sum < 0){
|
||||
angle *= -1.;
|
||||
}
|
||||
} else {
|
||||
angle = Acosd(angle);
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
void scaleVector(MATRIX v, double scale)
|
||||
|
Reference in New Issue
Block a user