bool GfRay::Intersect(const GfPlane &plane, double *distance, bool *frontFacing) const { // The dot product of the ray direction and the plane normal // indicates the angle between them. Reject glancing // intersections. Note: this also rejects ill-formed planes with // zero normals. double d = GfDot(_direction, plane.GetNormal()); if (d < GF_MIN_VECTOR_LENGTH && d > -GF_MIN_VECTOR_LENGTH) return false; // Get a point on the plane. GfVec3d planePoint = plane.GetDistanceFromOrigin() * plane.GetNormal(); // Compute the parametric distance t to the plane. Reject // intersections outside the ray bounds. double t = GfDot(planePoint - _startPoint, plane.GetNormal()) / d; if (t < 0.0) return false; if (distance) *distance = t; if (frontFacing) *frontFacing = (d < 0.0); return true; }
static string _Repr(GfPlane const &self) { return TF_PY_REPR_PREFIX + "Plane(" + TfPyRepr(self.GetNormal()) + ", " + TfPyRepr(self.GetDistanceFromOrigin()) + ")"; }