/// <summary> /// Writes the given <see cref="Planed"/> to an <see cref="Ibasa.IO.BinaryWriter">. /// </summary> public static void Write(this Ibasa.IO.BinaryWriter writer, Planed plane) { writer.Write(plane.Normal.X); writer.Write(plane.Normal.Y); writer.Write(plane.Normal.Z); writer.Write(plane.D); }
/// <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 Planed Normalize(Planed plane) { return(new Planed(Vector.Normalize(plane.Normal), plane.D)); }
/// <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 double DotNormal(Planed plane, Vector3d normal) { return((plane.Normal.X * normal.X) + (plane.Normal.Y * normal.Y) + (plane.Normal.Z * normal.Z)); }
/// <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 double DotCoordinate(Planed plane, Point3d point) { return((plane.Normal.X * point.X) + (plane.Normal.Y * point.Y) + (plane.Normal.Z * point.Z) + plane.D); }
/// <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 double Dot(Planed plane, Vector4d vector) { return((plane.Normal.X * vector.X) + (plane.Normal.Y * vector.Y) + (plane.Normal.Z * vector.Z) + (plane.D * vector.W)); }
/// <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(Planed left, Planed right) { return(left == right); }
/// <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 Planed Multiply(Planed plane, double scalar) { return(new Planed(plane.Normal.X * scalar, plane.Normal.Y * scalar, plane.Normal.Z * scalar, plane.D * scalar)); }