Beispiel #1
0
RNBoolean R3Contains(const R3Point& point1, const R3Point& point2)
{
    // Return whether point1 and point2 are equal to within tolerance
    return (RNIsEqual(point1.X(), point2.X()) &&
            RNIsEqual(point1.Y(), point2.Y()) &&
            RNIsEqual(point1.Z(), point2.Z()));
}
Beispiel #2
0
RNBoolean R3Contains(const R3Vector& vector1, const R3Vector& vector2)
{
    // Return whether vector1 and vector2 are equal within tolerance
    return (RNIsEqual(vector1.X(), vector2.X()) &&
            RNIsEqual(vector1.Y(), vector2.Y()) &&
            RNIsEqual(vector1.Z(), vector2.Z()));
}
Beispiel #3
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 #4
0
RNBoolean R3Contains(const R3Halfspace& halfspace1, const R3Halfspace& halfspace2)
{
    // Return whether halfspace1 contains halfspace2
    RNScalar dot = halfspace1.Plane().Normal().Dot(halfspace2.Plane().Normal());
    if (RNIsEqual(dot, 1.0)) {
	// Halfspace and plane are parallel ???
	return RNIsLessOrEqual(halfspace1.Plane().D(), halfspace2.Plane().D());
    }
    else {
	// Halfspace and plane are not parallel
	return FALSE;
    }
}
Beispiel #5
0
RNBoolean R3Parallel(const R3Vector& vector1, const R3Vector& vector2)
{
    // Return whether two vectors are coincident (or anti-coincident)
    if ((RNIsEqual(vector1.X(), vector2.X())) &&
        (RNIsEqual(vector1.Y(), vector2.Y())) && 
        (RNIsEqual(vector1.Z(), vector2.Z()))) return TRUE;
    if ((RNIsEqual(vector1.X(), -vector2.X())) &&
        (RNIsEqual(vector1.Y(), -vector2.Y())) && 
        (RNIsEqual(vector1.Z(), -vector2.Z()))) return TRUE;
    return FALSE;
}
Beispiel #6
0
RNBoolean R3Contains(const R3Plane& plane1, const R3Plane& plane2)
{
    // Return whether plane1 and plane2 are equal within tolerance
    return (R3Contains(plane1.Normal(), plane2.Normal()) &&
	    RNIsEqual(plane1.D(), plane2.D()));
}