コード例 #1
0
ファイル: Point4d.cs プロジェクト: JamesTryand/NVecMath
 /// <summary>Constructs and initializes a Point4d from the specified Point4f.</summary>
 /// <remarks>Constructs and initializes a Point4d from the specified Point4f.</remarks>
 /// <param name="p1">the Point4f containing the initialization x y z w data</param>
 public Point4d(Point4f p1)
     : base(p1)
 {
 }
コード例 #2
0
ファイル: Point3f.cs プロジェクト: JamesTryand/NVecMath
 /// <summary>
 /// Multiplies each of the x,y,z components of the Point4f parameter
 /// by 1/w and places the projected values into this point.
 /// </summary>
 /// <remarks>
 /// Multiplies each of the x,y,z components of the Point4f parameter
 /// by 1/w and places the projected values into this point.
 /// </remarks>
 /// <param name="p1">the source Point4f, which is not modified</param>
 public void Project(Point4f p1)
 {
     float oneOw;
     oneOw = 1 / p1.w;
     x = p1.x * oneOw;
     y = p1.y * oneOw;
     z = p1.z * oneOw;
 }
コード例 #3
0
ファイル: Point4f.cs プロジェクト: JamesTryand/NVecMath
 /// <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 float DistanceLinf(Point4f p1)
 {
     float t1;
     float 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));
 }
コード例 #4
0
ファイル: Point4f.cs プロジェクト: JamesTryand/NVecMath
 /// <summary>Computes the square of the distance between this point and point p1.</summary>
 /// <remarks>Computes the square of the distance between this point and point p1.</remarks>
 /// <param name="p1">the other point</param>
 /// <returns>the square of distance between these two points as a float</returns>
 public float DistanceSquared(Point4f p1)
 {
     float dx;
     float dy;
     float dz;
     float 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);
 }
コード例 #5
0
ファイル: Point4f.cs プロジェクト: JamesTryand/NVecMath
 /// <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 float DistanceL1(Point4f 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));
 }