Beispiel #1
0
 /// <summary>
 /// Writes the given <see cref="Planef"/> to an <see cref="Ibasa.IO.BinaryWriter">.
 /// </summary>
 public static void Write(this Ibasa.IO.BinaryWriter writer, Planef plane)
 {
     writer.Write(plane.Normal.X);
     writer.Write(plane.Normal.Y);
     writer.Write(plane.Normal.Z);
     writer.Write(plane.D);
 }
Beispiel #2
0
 /// <summary>
 /// Changes the coefficients of the normal vector of a plane to make it of unit length.
 /// </summary>
 /// <param name="plane">The plane to normalize.</param>
 /// <returns>A new plane with a normal having unit length.</returns>
 public static Planef Normalize(Planef plane)
 {
     return(new Planef(Vector.Normalize(plane.Normal), plane.D));
 }
Beispiel #3
0
 /// <summary>
 /// Calculates the dot product of the specified vector and the normal of the plane.
 /// </summary>
 /// <param name="plane">The source plane.</param>
 /// <param name="normal">The source vector.</param>
 /// <returns>The dot product of the specified vector and the normal of the plane.</returns>
 public static float DotNormal(Planef plane, Vector3f normal)
 {
     return((plane.Normal.X * normal.X) + (plane.Normal.Y * normal.Y) + (plane.Normal.Z * normal.Z));
 }
Beispiel #4
0
 /// <summary>
 /// Calculates the dot product of a specified vector and the normal of the plane plus the distance value of the plane.
 /// </summary>
 /// <param name="plane">The source plane.</param>
 /// <param name="point">The source point.</param>
 /// <returns>The dot product of a specified vector and the normal of the Plane plus the distance value of the plane.</returns>
 public static float DotCoordinate(Planef plane, Point3f point)
 {
     return((plane.Normal.X * point.X) + (plane.Normal.Y * point.Y) + (plane.Normal.Z * point.Z) + plane.D);
 }
Beispiel #5
0
 /// <summary>
 /// Calculates the dot product of the specified vector and plane.
 /// </summary>
 /// <param name="plane">The source plane.</param>
 /// <param name="vector">The source vector.</param>
 /// <returns>The dot product of the specified point and plane.</returns>
 public static float Dot(Planef plane, Vector4f vector)
 {
     return((plane.Normal.X * vector.X) + (plane.Normal.Y * vector.Y) + (plane.Normal.Z * vector.Z) + (plane.D * vector.W));
 }
Beispiel #6
0
 /// <summary>
 /// Returns a value that indicates whether two planes are equal.
 /// </summary>
 /// <param name="left">The first plane to compare.</param>
 /// <param name="right">The second plane to compare.</param>
 /// <returns>true if the left and right are equal; otherwise, false.</returns>
 public static bool Equals(Planef left, Planef right)
 {
     return(left == right);
 }
Beispiel #7
0
 /// <summary>
 /// Returns the product of a plane and scalar.
 /// </summary>
 /// <param name="plane">The plane to multiply.</param>
 /// <param name="scalar">The scalar to multiply.</param>
 /// <returns>The product of the left and right parameters.</returns>
 public static Planef Multiply(Planef plane, float scalar)
 {
     return(new Planef(plane.Normal.X * scalar, plane.Normal.Y * scalar, plane.Normal.Z * scalar, plane.D * scalar));
 }