Beispiel #1
0
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;
}
Beispiel #2
0
RNLength R2Distance(const R2Point& point, const R2Line& line)
{
    // Return distance from point to line 
    RNLength d = point.X() * line.A() + point.Y() * line.B() + line.C();
    return (d < 0.0) ? -d : d;
}
Beispiel #3
0
RNLength R2SignedDistance(const R2Line& line, const R2Point& point)
{
    // Return signed distance from point to line 
    return (point.X()*line.A() + point.Y()*line.B() + line.C());
}