5using Microsoft.Xna.Framework.Design;
13 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
16 [SuppressMessage(
"Microsoft.Design",
"CA1051:DoNotDeclareVisibleInstanceFields")]
19 public Plane(
float a,
float b,
float c,
float d)
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 num10 = num7 * num7 + num8 * num8 + num9 * num9;
53 float num11 = 1f / (float)
Math.
Sqrt(num10);
54 Normal.X = num7 * num11;
55 Normal.Y = num8 * num11;
56 Normal.Z = num9 * num11;
57 D = 0f - (Normal.X * point1.X + Normal.Y * point1.Y + Normal.Z * point1.
Z);
87 return string.Format(currentCulture,
"{{Normal:{0} D:{1}}}",
new object[2]
90 D.ToString(currentCulture)
96 float num = Normal.X * Normal.X + Normal.Y * Normal.Y + Normal.Z *
Normal.
Z;
97 if (!(
Math.
Abs(num - 1f) < 1.1920929E-07f))
99 float num2 = 1f / (float)
Math.
Sqrt(num);
109 float num = value.Normal.X * value.Normal.X + value.Normal.Y * value.Normal.Y + value.Normal.Z *
value.Normal.Z;
111 if (
Math.
Abs(num - 1f) < 1.1920929E-07f)
117 float num2 = 1f / (float)
Math.
Sqrt(num);
118 result.Normal.X = value.Normal.X * num2;
119 result.Normal.Y = value.Normal.Y * num2;
120 result.Normal.Z = value.Normal.Z * num2;
121 result.D = value.D * num2;
127 float num = value.Normal.X * value.Normal.X + value.Normal.Y * value.Normal.Y + value.Normal.Z *
value.Normal.Z;
128 if (
Math.
Abs(num - 1f) < 1.1920929E-07f)
130 result.Normal =
value.Normal;
134 float num2 = 1f / (float)
Math.
Sqrt(num);
135 result.Normal.X = value.Normal.X * num2;
136 result.Normal.Y = value.Normal.Y * num2;
137 result.Normal.Z = value.Normal.Z * num2;
138 result.D = value.D * num2;
149 result2.Normal.X = x * result.M11 + y * result.M12 + z * result.M13 + d * result.M14;
150 result2.Normal.Y = x * result.M21 + y * result.M22 + z * result.M23 + d * result.M24;
151 result2.Normal.Z = x * result.M31 + y * result.M32 + z * result.M33 + d * result.M34;
152 result2.D = x * result.M41 + y * result.M42 + z * result.M43 + d * result.M44;
159 float x = plane.Normal.X;
160 float y = plane.Normal.Y;
161 float z = plane.Normal.Z;
163 result.Normal.X = x * result2.M11 + y * result2.M12 + z * result2.M13 + d * result2.M14;
164 result.Normal.Y = x * result2.M21 + y * result2.M22 + z * result2.M23 + d * result2.M24;
165 result.Normal.Z = x * result2.M31 + y * result2.M32 + z * result2.M33 + d * result2.M34;
166 result.D = x * result2.M41 + y * result2.M42 + z * result2.M43 + d * result2.M44;
171 float num = rotation.X + rotation.
X;
172 float num2 = rotation.Y + rotation.
Y;
173 float num3 = rotation.Z + rotation.
Z;
174 float num4 = rotation.W * num;
175 float num5 = rotation.W * num2;
176 float num6 = rotation.W * num3;
177 float num7 = rotation.X * num;
178 float num8 = rotation.X * num2;
179 float num9 = rotation.X * num3;
180 float num10 = rotation.Y * num2;
181 float num11 = rotation.Y * num3;
182 float num12 = rotation.Z * num3;
183 float num13 = 1f - num10 - num12;
184 float num14 = num8 - num6;
185 float num15 = num9 + num5;
186 float num16 = num8 + num6;
187 float num17 = 1f - num7 - num12;
188 float num18 = num11 - num4;
189 float num19 = num9 - num5;
190 float num20 = num11 + num4;
191 float num21 = 1f - num7 - num10;
196 result.Normal.X = x * num13 + y * num14 + z * num15;
197 result.Normal.Y = x * num16 + y * num17 + z * num18;
198 result.Normal.Z = x * num19 + y * num20 + z * num21;
205 float num = rotation.X + rotation.X;
206 float num2 = rotation.Y + rotation.Y;
207 float num3 = rotation.Z + rotation.Z;
208 float num4 = rotation.W * num;
209 float num5 = rotation.W * num2;
210 float num6 = rotation.W * num3;
211 float num7 = rotation.X * num;
212 float num8 = rotation.X * num2;
213 float num9 = rotation.X * num3;
214 float num10 = rotation.Y * num2;
215 float num11 = rotation.Y * num3;
216 float num12 = rotation.Z * num3;
217 float num13 = 1f - num10 - num12;
218 float num14 = num8 - num6;
219 float num15 = num9 + num5;
220 float num16 = num8 + num6;
221 float num17 = 1f - num7 - num12;
222 float num18 = num11 - num4;
223 float num19 = num9 - num5;
224 float num20 = num11 + num4;
225 float num21 = 1f - num7 - num10;
226 float x = plane.Normal.X;
227 float y = plane.Normal.Y;
228 float z = plane.Normal.Z;
229 result.Normal.X = x * num13 + y * num14 + z * num15;
230 result.Normal.Y = x * num16 + y * num17 + z * num18;
231 result.Normal.Z = x * num19 + y * num20 + z * num21;
237 return Normal.X * value.X + Normal.Y * value.Y + Normal.Z * value.Z +
D *
value.W;
242 result = Normal.X * value.X + Normal.Y * value.Y + Normal.Z * value.Z +
D *
value.W;
247 return Normal.X * value.X + Normal.Y * value.Y + Normal.Z * value.Z +
D;
252 result = Normal.X * value.X + Normal.Y * value.Y + Normal.Z * value.Z +
D;
257 return Normal.X * value.X + Normal.Y * value.Y + Normal.Z *
value.Z;
262 result = Normal.X * value.X + Normal.Y * value.Y + Normal.Z *
value.Z;
268 vector.X = ((Normal.X >= 0f) ? box.
Min.
X : box.
Max.
X);
269 vector.Y = ((Normal.Y >= 0f) ? box.
Min.
Y : box.
Max.
Y);
270 vector.Z = ((Normal.Z >= 0f) ? box.
Min.
Z : box.
Max.
Z);
272 vector2.X = ((Normal.X >= 0f) ? box.
Max.
X : box.
Min.
X);
273 vector2.Y = ((Normal.Y >= 0f) ? box.
Max.
Y : box.
Min.
Y);
274 vector2.Z = ((Normal.Z >= 0f) ? box.
Max.
Z : box.
Min.
Z);
275 float num = Normal.X * vector.X + Normal.Y * vector.Y + Normal.Z * vector.
Z;
280 num = Normal.X * vector2.X + Normal.Y * vector2.Y + Normal.Z * vector2.
Z;
291 vector.X = ((Normal.X >= 0f) ? box.Min.X : box.Max.X);
292 vector.Y = ((Normal.Y >= 0f) ? box.Min.Y : box.Max.Y);
293 vector.Z = ((Normal.Z >= 0f) ? box.Min.Z : box.Max.Z);
295 vector2.X = ((Normal.X >= 0f) ? box.Max.X : box.Min.X);
296 vector2.Y = ((Normal.Y >= 0f) ? box.Max.Y : box.Min.Y);
297 vector2.Z = ((Normal.Z >= 0f) ? box.Max.Z : box.Min.Z);
298 float num = Normal.X * vector.X + Normal.Y * vector.Y + Normal.Z * vector.
Z;
304 num = Normal.X * vector2.X + Normal.Y * vector2.Y + Normal.Z * vector2.
Z;
326 float num = sphere.Center.X * Normal.X + sphere.Center.Y * Normal.Y + sphere.Center.Z *
Normal.
Z;
327 float num2 = num +
D;
332 if (num2 < 0f - sphere.
Radius)
341 float num = sphere.Center.X * Normal.X + sphere.Center.Y * Normal.Y + sphere.Center.Z *
Normal.
Z;
342 float num2 = num +
D;
343 if (num2 > sphere.Radius)
347 else if (num2 < 0f - sphere.Radius)
366 return lhs.D != rhs.
D;
bool Intersects(BoundingBox box)
static string NullNotAllowed
static CultureInfo CurrentCulture
static double Sqrt(double d)
static double Abs(double value)
static Matrix Invert(Matrix matrix)
override int GetHashCode()
float DotCoordinate(Vector3 value)
void Intersects(ref BoundingSphere sphere, out PlaneIntersectionType result)
float DotNormal(Vector3 value)
void Intersects(ref BoundingBox box, out PlaneIntersectionType result)
static Plane Transform(Plane plane, Matrix matrix)
void DotCoordinate(ref Vector3 value, out float result)
PlaneIntersectionType Intersects(BoundingFrustum frustum)
PlaneIntersectionType Intersects(BoundingBox box)
static Plane Transform(Plane plane, Quaternion rotation)
static bool operator!=(Plane lhs, Plane rhs)
Plane(float a, float b, float c, float d)
Plane(Vector3 normal, float d)
void Dot(ref Vector4 value, out float result)
PlaneIntersectionType Intersects(BoundingSphere sphere)
static Plane Normalize(Plane value)
override bool Equals(object obj)
static void Normalize(ref Plane value, out Plane result)
void DotNormal(ref Vector3 value, out float result)
override string ToString()
Plane(Vector3 point1, Vector3 point2, Vector3 point3)
static bool operator==(Plane lhs, Plane rhs)
static void Transform(ref Plane plane, ref Matrix matrix, out Plane result)
static void Transform(ref Plane plane, ref Quaternion rotation, out Plane result)
override string ToString()
override int GetHashCode()