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

Function proper_intersection

Geometry/Geometry 3D.cpp:578–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578bool proper_intersection(p3 a, p3 b, p3 c, p3 d, p3 &out) {
579 p3 ab = a * b, cd = c * d; // normals of planes OAB and OCD
580 int oa = sign(cd | a),
581 ob = sign(cd | b),
582 oc = sign(ab | c),
583 od = sign(ab | d);
584 out = ab * cd * od; // four multiplications => careful with overflow!
585 return (oa != ob && oc != od && oa != oc);
586}
587
588// Assume that the sphere is centered at the origin
589bool point_on_sphere_segment(p3 a, p3 b, p3 p) {

Calls 1

signFunction · 0.70

Tested by

no test coverage detected