/// <summary>
        /// Tests for intersection between a <see cref="Segment"/> and a <see cref="Plane"/>.
        /// </summary>
        /// <param name="line">A <see cref="Segment"/> instance.</param>
        /// <param name="plane">A <see cref="Plane"/> instance.</param>
        /// <returns><see langword="true"/> if intersection occurs; otherwise, <see langword="false"/>.</returns>
        public static bool TestIntersection(Segment segment, Plane plane)
        {
            // Get the position of the line's end point relative to the plane.
            int sign0 = (int)plane.GetSign(segment.P0);
            int sign1 = (int)plane.GetSign(segment.P1);

            // Intersection occurs if the 2 endpoints are at oposite sides of the plane.
            return ( ((sign0 > 0) && (sign1 < 0)) || ((sign0 < 0) && (sign0 > 0)) );
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Segment"/> class using an existing <see cref="Segment"/> instance.
 /// </summary>
 /// <param name="l">A <see cref="Segment"/> instance.</param>
 public Segment(Segment l)
 {
     _p0 = l.P0;
     _p1 = l.P1;
 }
        /// <summary>
        /// Tests for intersection between a <see cref="Segment"/> and a <see cref="Plane"/>
        /// </summary>
        /// <param name="line">A <see cref="Segment"/> instance.</param>
        /// <param name="plane">A <see cref="Plane"/> instance.</param>
        /// <returns>An <see cref="IntersectionPair"/> instance containing the intersection information.</returns>
        public static IntersectionPair Intersects(Segment segment, Plane plane)
        {
            if (TestIntersection(segment, plane) == false)
                return new IntersectionPair(false, Vector3F.Zero);

            Vector3F dir = segment.P1 - segment.P0;
            float d  = Vector3F.Dot(plane.Normal, dir);
            float t  = (plane.Constant - Vector3F.Dot(plane.Normal, segment.P0)) / d;

            return new IntersectionPair(true, segment.P0 + dir*t);
        }