MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / GetAngle

Method GetAngle

src/Base/Tools2D.cpp:34–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32using namespace Base;
33
34double Vector2d::GetAngle(const Vector2d& vec) const
35{
36 double fDivid = 0.0;
37 double fNum = 0.0;
38
39 fDivid = Length() * vec.Length();
40
41 if ((fDivid < -1e-10) || (fDivid > 1e-10)) {
42 fNum = (*this * vec) / fDivid;
43 if (fNum < -1) {
44 return std::numbers::pi;
45 }
46 if (fNum > 1) {
47 return 0.0;
48 }
49
50 return acos(fNum);
51 }
52
53 return -std::numeric_limits<double>::max(); // division by zero
54}
55
56void Vector2d::ProjectToLine(const Vector2d& point, const Vector2d& line)
57{

Callers 15

evaluateMethod · 0.45
writeMethod · 0.45
getAngleMethod · 0.45
getAngleMethod · 0.45
validateOffsetProfileMethod · 0.45
getRotateAngleMethod · 0.45
closestBasisMethod · 0.45
closestBasisOrientedMethod · 0.45
getProjectedDimValueMethod · 0.45
checkDirectionVsBasisFunction · 0.45
rotateToAlignMethod · 0.45

Calls 4

LengthFunction · 0.85
acosFunction · 0.85
maxFunction · 0.85
LengthMethod · 0.45

Tested by

no test coverage detected