Axiom.Math.Plane.GetDistance C# (CSharp) Method

GetDistance() public method

This is a pseudodistance. The sign of the return value is positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane. The absolute value of the return value is the true distance only when the plane normal is a unit length vector.
public GetDistance ( Axiom.Math.Vector3 point ) : Real
point Axiom.Math.Vector3
return Real
		public Real GetDistance( Vector3 point )
		{
			return this.Normal.Dot( point ) + this.D;
		}

Usage Example

        /// <summary>
        ///		Intersection test with <see cref="Sphere"/>.
        /// </summary>
        /// <param name="sphere">Sphere to test.</param>
        /// <returns>True if the sphere intersects this volume, and false otherwise.</returns>
        public bool Intersects(Sphere sphere)
        {
            for (int i = 0; i < planes.Count; i++)
            {
                Plane plane = (Plane)planes[i];

                // Test which side of the plane the sphere is
                Real d = plane.GetDistance(sphere.Center);

                // Negate d if planes point inwards
                if (outside == PlaneSide.Negative)
                {
                    d = -d;
                }

                if ((d - sphere.Radius) > 0)
                {
                    return(false);
                }
            }

            // assume intersecting
            return(true);
        }
All Usage Examples Of Axiom.Math.Plane::GetDistance