Vector3D.Dot C# (CSharp) Method

Dot() public static method

public static Dot ( Vector3D, lhs, Vector3D, rhs ) : double
lhs Vector3D,
rhs Vector3D,
return double
    public static double Dot(Vector3D lhs, Vector3D rhs)
    {
        return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z;
    }

Usage Example

Esempio n. 1
0
        public static bool TryRayPlane(
            Vector3D rayOrigin, 
            Vector3D rayDirection, 
            Vector3D planeNormal, 
            double planeD, 
            out Vector3D intersectionPoint)
        {
            double denominator = planeNormal.Dot(rayDirection);

            if (Math.Abs(denominator) < 0.00000000000000000001)
            {
                //
                // Ray is parallel to plane.  The ray may be in the polygon's plane.
                //
                intersectionPoint = Vector3D.Zero;
                return false;
            }

            double t = (-planeD - planeNormal.Dot(rayOrigin)) / denominator;

            if (t < 0)
            {
                intersectionPoint = Vector3D.Zero;
                return false;
            }

            intersectionPoint = rayOrigin + (t * rayDirection);
            return true;
        }
All Usage Examples Of Vector3D::Dot