MCPcopy Create free account
hub / github.com/creatale/node-dv / fastAtan2

Function fastAtan2

deps/opencv/modules/core/src/mathfuncs.cpp:56–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54static const float atan2_p7 = -0.04432655554792128f*(float)(180/CV_PI);
55
56float fastAtan2( float y, float x )
57{
58 float ax = std::abs(x), ay = std::abs(y);
59 float a, c, c2;
60 if( ax >= ay )
61 {
62 c = ay/(ax + (float)DBL_EPSILON);
63 c2 = c*c;
64 a = (((atan2_p7*c2 + atan2_p5)*c2 + atan2_p3)*c2 + atan2_p1)*c;
65 }
66 else
67 {
68 c = ax/(ay + (float)DBL_EPSILON);
69 c2 = c*c;
70 a = 90.f - (((atan2_p7*c2 + atan2_p5)*c2 + atan2_p3)*c2 + atan2_p1)*c;
71 }
72 if( x < 0 )
73 a = 180.f - a;
74 if( y < 0 )
75 a = 360.f - a;
76 return a;
77}
78
79static void FastAtan2_32f(const float *Y, const float *X, float *angle, int len, bool angleInDegrees=true )
80{

Callers 6

cvFastArctanFunction · 0.85
processTemplMethod · 0.85
calcHistMethod · 0.85
operator ()Method · 0.85
buildFeatureListMethod · 0.85
getContourPointsMethod · 0.85

Calls 2

FastAtan2_32fFunction · 0.85
absFunction · 0.70

Tested by

no test coverage detected