RNLength R2SignedDistance(const R2Line& line1, const R2Line& line2) { // Return signed distance from line to line RNScalar dot = line1.Vector().Dot(line2.Vector()); if (RNIsEqual(dot, 1.0)) return (line1.C() - line2.C()); else if (RNIsEqual(dot, -1.0)) return (line1.C() + line2.C()); else return 0.0; }
void R2Line:: Project(const R2Line& line) { // Project line onto another line *this = line; if (Vector().Dot(line.Vector()) < 0.0) Flip(); }