/// <summary>Constructs and initializes a Point3f from the specified Point3d.</summary> /// <remarks>Constructs and initializes a Point3f from the specified Point3d.</remarks> /// <param name="p1">the Point3d containing the initialization x y z data</param> public Point3f(Point3d p1) : base(p1) { }
/// <summary>Returns the distance between this point and point p1.</summary> /// <remarks>Returns the distance between this point and point p1.</remarks> /// <param name="p1">the other point</param> /// <returns>the distance</returns> public double Distance(Point3d p1) { double dx; double dy; double dz; dx = this.x - p1.x; dy = this.y - p1.y; dz = this.z - p1.z; return Math.Sqrt(dx * dx + dy * dy + dz * dz); }
// Compatible with 1.1 /// <summary>Returns the square of the distance between this point and point p1.</summary> /// <remarks>Returns the square of the distance between this point and point p1.</remarks> /// <param name="p1">the other point</param> /// <returns>the square of the distance</returns> public double DistanceSquared(Point3d p1) { double dx; double dy; double dz; dx = this.x - p1.x; dy = this.y - p1.y; dz = this.z - p1.z; return (dx * dx + dy * dy + dz * dz); }
/// <summary> /// Computes the L-infinite distance between this point and /// point p1. /// </summary> /// <remarks> /// Computes the L-infinite distance between this point and /// point p1. The L-infinite distance is equal to /// MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)]. /// </remarks> /// <param name="p1">the other point</param> /// <returns>the L-infinite distance</returns> public double DistanceLinf(Point3d p1) { double tmp; tmp = Math.Max(Math.Abs(this.x - p1.x), Math.Abs(this.y - p1.y)); return Math.Max(tmp, Math.Abs(this.z - p1.z)); }
/// <summary> /// Computes the L-1 (Manhattan) distance between this point and /// point p1. /// </summary> /// <remarks> /// Computes the L-1 (Manhattan) distance between this point and /// point p1. The L-1 distance is equal to: /// abs(x1-x2) + abs(y1-y2) + abs(z1-z2). /// </remarks> /// <param name="p1">the other point</param> /// <returns>the L-1 distance</returns> public double DistanceL1(Point3d p1) { return Math.Abs(this.x - p1.x) + Math.Abs(this.y - p1.y) + Math.Abs(this.z - p1.z ); }
/// <summary> /// Transforms the point parameter with this Matrix4d and /// places the result back into point. /// </summary> /// <remarks> /// Transforms the point parameter with this Matrix4d and /// places the result back into point. The fourth element of the /// point input parameter is assumed to be one. /// </remarks> /// <param name="point">the input point to be transformed.</param> public void Transform(Point3d point) { double x; double y; x = m00 * point.x + m01 * point.y + m02 * point.z + m03; y = m10 * point.x + m11 * point.y + m12 * point.z + m13; point.z = m20 * point.x + m21 * point.y + m22 * point.z + m23; point.x = x; point.y = y; }