Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateFromVertices()

static Plane System.Numerics.Plane.CreateFromVertices ( Vector3 point1,
Vector3 point2,
Vector3 point3 )
inlinestatic

Definition at line 32 of file Plane.cs.

33 {
34 if (Vector.IsHardwareAccelerated)
35 {
36 Vector3 vector = point2 - point1;
37 Vector3 vector2 = point3 - point1;
38 Vector3 value = Vector3.Cross(vector, vector2);
39 Vector3 vector3 = Vector3.Normalize(value);
40 float d = 0f - Vector3.Dot(vector3, point1);
41 return new Plane(vector3, d);
42 }
43 float num = point2.X - point1.X;
44 float num2 = point2.Y - point1.Y;
45 float num3 = point2.Z - point1.Z;
46 float num4 = point3.X - point1.X;
47 float num5 = point3.Y - point1.Y;
48 float num6 = point3.Z - point1.Z;
49 float num7 = num2 * num6 - num3 * num5;
50 float num8 = num3 * num4 - num * num6;
51 float num9 = num * num5 - num2 * num4;
52 float x = num7 * num7 + num8 * num8 + num9 * num9;
53 float num10 = 1f / MathF.Sqrt(x);
54 Vector3 normal = new Vector3(num7 * num10, num8 * num10, num9 * num10);
55 return new Plane(normal, 0f - (normal.X * point1.X + normal.Y * point1.Y + normal.Z * point1.Z));
56 }
Plane(float x, float y, float z, float d)
Definition Plane.cs:13

References System.Numerics.Plane.Plane(), System.Numerics.Vector3.Cross(), System.Numerics.Vector3.Dot(), System.Numerics.Vector< T >.IsHardwareAccelerated, System.Numerics.Vector3.Normalize(), System.MathF.Sqrt(), System.value, System.Numerics.Vector3.X, System.Numerics.Vector3.Y, and System.Numerics.Vector3.Z.