MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / VAngle

Function VAngle

general.cpp:263–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261// Like RAngle() but return the angle between two 3D vectors instead.
262
263real VAngle(CONST PT3R *v1, CONST PT3R *v2)
264{
265 real angle, len1, len2;
266
267 len1 = PtLen((*v1));
268 len2 = PtLen((*v2));
269 if (len1 != 0.0 && len2 != 0.0) {
270 angle = PtDot((*v1), (*v2))/len1/len2;
271 if (angle == 0.0)
272 return rPiHalf;
273 else if (angle <= -1.0)
274 return rPi;
275 angle = RAtn(RSqr(1.0 - Sq(angle)) / angle);
276 if (angle >= 0.0)
277 return angle;
278 else
279 return angle + rPi;
280 } else
281 return rPiHalf;
282}
283
284
285// Modulus function for floating point values, in which we bring the given

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected