MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / get_angle

Function get_angle

Geometry/Geometry 2D.cpp:52–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50double rad_to_deg(double r) { return (r * 180.0 / PI); }
51double deg_to_rad(double d) { return (d * PI / 180.0); }
52double get_angle(PT a, PT b) {
53 double costheta = dot(a, b) / a.norm() / b.norm();
54 return acos(max((double)-1.0, min((double)1.0, costheta)));
55}
56bool is_point_in_angle(PT b, PT a, PT c, PT p) { // does point p lie in angle <bac
57 assert(orientation(a, b, c) != 0);
58 if (orientation(a, c, b) < 0) swap(b, c);

Callers

nothing calls this directly

Calls 2

dotFunction · 0.70
normMethod · 0.45

Tested by

no test coverage detected