MCPcopy Create free account
hub / github.com/chrxh/alien / angleOfVector

Method angleOfVector

source/Base/Math.cpp:10–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10float Math::angleOfVector(RealVector2D const& v)
11{
12 auto vLength = length(v);
13 if (vLength < NEAR_ZERO) {
14 return 0;
15 }
16 float angle;
17 auto angleSin = asinf(-v.y / vLength) * Const::RadToDeg;
18 if (v.x >= 0.0) {
19 angle = 90.0 - angleSin;
20 } else {
21 angle = angleSin + 270.0;
22 }
23 return angle;
24}
25
26RealVector2D Math::rotateQuarterCounterClockwise(RealVector2D v)
27{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected