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

Function circle_line_relation

Geometry/Geometry 2D.cpp:309–314  ·  view source on GitHub ↗

0 if outside, 1 if on circumference, 2 if inside circle

Source from the content-addressed store, hash-verified

307}
308// 0 if outside, 1 if on circumference, 2 if inside circle
309int circle_line_relation(PT p, double r, PT a, PT b) {
310 double d = dist_from_point_to_line(a, b, p);
311 if (sign(d - r) < 0) return 2;
312 if (sign(d - r) == 0) return 1;
313 return 0;
314}
315//compute intersection of line through points a and b with
316//circle centered at c with radius r > 0
317vector<PT> circle_line_intersection(PT c, double r, PT a, PT b) {

Callers

nothing calls this directly

Calls 2

dist_from_point_to_lineFunction · 0.85
signFunction · 0.70

Tested by

no test coverage detected