/// <summary>Constructs and initializes a Point4d from the specified Point4d.</summary> /// <remarks>Constructs and initializes a Point4d from the specified Point4d.</remarks> /// <param name="p1">the Point4d containing the initialization x y z w data</param> public Point4d(Point4d p1) : base(p1) { }
/// <summary> /// Multiplies each of the x,y,z components of the Point4d parameter /// by 1/w, places the projected values into this point, and places /// a 1 as the w parameter of this point. /// </summary> /// <remarks> /// Multiplies each of the x,y,z components of the Point4d parameter /// by 1/w, places the projected values into this point, and places /// a 1 as the w parameter of this point. /// </remarks> /// <param name="p1">the source Point4d, which is not modified</param> public void Project(Point4d p1) { double oneOw; oneOw = 1 / p1.w; x = p1.x * oneOw; y = p1.y * oneOw; z = p1.z * oneOw; w = 1.0; }
/// <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), abs(w1-w2)]. /// </remarks> /// <param name="p1">the other point</param> /// <returns>the L-infinite distance</returns> public double DistanceLinf(Point4d p1) { double t1; double t2; t1 = Math.Max(Math.Abs(this.x - p1.x), Math.Abs(this.y - p1.y)); t2 = Math.Max(Math.Abs(this.z - p1.z), Math.Abs(this.w - p1.w)); return Math.Max(t1, t2); }
/// <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 first point</param> /// <returns>the square of distance between this point and point p1</returns> public double DistanceSquared(Point4d p1) { double dx; double dy; double dz; double dw; dx = this.x - p1.x; dy = this.y - p1.y; dz = this.z - p1.z; dw = this.w - p1.w; return (dx * dx + dy * dy + dz * dz + dw * dw); }
/// <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) + abs(w1-w2). /// </remarks> /// <param name="p1">the other point</param> /// <returns>the L-1 distance</returns> public double DistanceL1(Point4d p1) { return Math.Abs(this.x - p1.x) + Math.Abs(this.y - p1.y) + Math.Abs(this.z - p1.z ) + Math.Abs(this.w - p1.w); }