Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
BoundingBox.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under MIT License. See LICENSE.md for details.
3 //
4 // -----------------------------------------------------------------------------
5 // Original code from SlimMath project. http://code.google.com/p/slimmath/
6 // Greetings to SlimDX Group. Original code published with the following license:
7 // -----------------------------------------------------------------------------
8 /*
9 * Copyright (c) 2007-2011 SlimDX Group
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * THE SOFTWARE.
28 */
29 using System;
30 using System.Globalization;
31 using System.Runtime.InteropServices;
32 using System.ComponentModel;
33 using SiliconStudio.Core.Serialization;
34 
35 namespace SiliconStudio.Core.Mathematics
36 {
37  /// <summary>
38  /// Represents an axis-aligned bounding box in three dimensional space.
39  /// </summary>
40  [DataContract]
41  [StructLayout(LayoutKind.Sequential, Pack = 4)]
42  public struct BoundingBox : IEquatable<BoundingBox>, IFormattable
43  {
44  /// <summary>
45  /// A <see cref="BoundingBox"/> which represents an empty space.
46  /// </summary>
47  public static readonly BoundingBox Empty = new BoundingBox(new Vector3(float.MaxValue), new Vector3(float.MinValue));
48 
49  /// <summary>
50  /// The minimum point of the box.
51  /// </summary>
52  public Vector3 Minimum;
53 
54  /// <summary>
55  /// The maximum point of the box.
56  /// </summary>
57  public Vector3 Maximum;
58 
59  /// <summary>
60  /// Initializes a new instance of the <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> struct.
61  /// </summary>
62  /// <param name="minimum">The minimum vertex of the bounding box.</param>
63  /// <param name="maximum">The maximum vertex of the bounding box.</param>
64  public BoundingBox(Vector3 minimum, Vector3 maximum)
65  {
66  this.Minimum = minimum;
67  this.Maximum = maximum;
68  }
69 
70  /// <summary>
71  /// Gets the center of this bouding box.
72  /// </summary>
73  public Vector3 Center
74  {
75  get { return (Minimum + Maximum)/2; }
76  }
77 
78  /// <summary>
79  /// Gets the extent of this bouding box.
80  /// </summary>
81  public Vector3 Extent
82  {
83  get { return (Maximum - Minimum) / 2; }
84  }
85 
86  /// <summary>
87  /// Retrieves the eight corners of the bounding box.
88  /// </summary>
89  /// <returns>An array of points representing the eight corners of the bounding box.</returns>
90  public Vector3[] GetCorners()
91  {
92  Vector3[] results = new Vector3[8];
93  results[0] = new Vector3(Minimum.X, Maximum.Y, Maximum.Z);
94  results[1] = new Vector3(Maximum.X, Maximum.Y, Maximum.Z);
95  results[2] = new Vector3(Maximum.X, Minimum.Y, Maximum.Z);
96  results[3] = new Vector3(Minimum.X, Minimum.Y, Maximum.Z);
97  results[4] = new Vector3(Minimum.X, Maximum.Y, Minimum.Z);
98  results[5] = new Vector3(Maximum.X, Maximum.Y, Minimum.Z);
99  results[6] = new Vector3(Maximum.X, Minimum.Y, Minimum.Z);
100  results[7] = new Vector3(Minimum.X, Minimum.Y, Minimum.Z);
101  return results;
102  }
103 
104  /// <summary>
105  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.Ray"/>.
106  /// </summary>
107  /// <param name="ray">The ray to test.</param>
108  /// <returns>Whether the two objects intersected.</returns>
109  public bool Intersects(ref Ray ray)
110  {
111  float distance;
112  return Collision.RayIntersectsBox(ref ray, ref this, out distance);
113  }
114 
115  /// <summary>
116  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.Ray"/>.
117  /// </summary>
118  /// <param name="ray">The ray to test.</param>
119  /// <param name="distance">When the method completes, contains the distance of the intersection,
120  /// or 0 if there was no intersection.</param>
121  /// <returns>Whether the two objects intersected.</returns>
122  public bool Intersects(ref Ray ray, out float distance)
123  {
124  return Collision.RayIntersectsBox(ref ray, ref this, out distance);
125  }
126 
127  /// <summary>
128  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.Ray"/>.
129  /// </summary>
130  /// <param name="ray">The ray to test.</param>
131  /// <param name="point">When the method completes, contains the point of intersection,
132  /// or <see cref="SiliconStudio.Core.Mathematics.Vector3.Zero"/> if there was no intersection.</param>
133  /// <returns>Whether the two objects intersected.</returns>
134  public bool Intersects(ref Ray ray, out Vector3 point)
135  {
136  return Collision.RayIntersectsBox(ref ray, ref this, out point);
137  }
138 
139  /// <summary>
140  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.Plane"/>.
141  /// </summary>
142  /// <param name="plane">The plane to test.</param>
143  /// <returns>Whether the two objects intersected.</returns>
145  {
146  return Collision.PlaneIntersectsBox(ref plane, ref this);
147  }
148 
149  /* This implentation is wrong
150  /// <summary>
151  /// Determines if there is an intersection between the current object and a triangle.
152  /// </summary>
153  /// <param name="vertex1">The first vertex of the triangle to test.</param>
154  /// <param name="vertex2">The second vertex of the triagnle to test.</param>
155  /// <param name="vertex3">The third vertex of the triangle to test.</param>
156  /// <returns>Whether the two objects intersected.</returns>
157  public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
158  {
159  return Collision.BoxIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3);
160  }
161  */
162 
163  /// <summary>
164  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/>.
165  /// </summary>
166  /// <param name="box">The box to test.</param>
167  /// <returns>Whether the two objects intersected.</returns>
168  public bool Intersects(ref BoundingBox box)
169  {
170  return Collision.BoxIntersectsBox(ref this, ref box);
171  }
172 
173  /// <summary>
174  /// Determines if there is an intersection between the current object and a <see cref="SiliconStudio.Core.Mathematics.BoundingSphere"/>.
175  /// </summary>
176  /// <param name="sphere">The sphere to test.</param>
177  /// <returns>Whether the two objects intersected.</returns>
178  public bool Intersects(ref BoundingSphere sphere)
179  {
180  return Collision.BoxIntersectsSphere(ref this, ref sphere);
181  }
182 
183  /// <summary>
184  /// Determines whether the current objects contains a point.
185  /// </summary>
186  /// <param name="point">The point to test.</param>
187  /// <returns>The type of containment the two objects have.</returns>
188  public ContainmentType Contains(ref Vector3 point)
189  {
190  return Collision.BoxContainsPoint(ref this, ref point);
191  }
192 
193  /* This implentation is wrong
194  /// <summary>
195  /// Determines whether the current objects contains a triangle.
196  /// </summary>
197  /// <param name="vertex1">The first vertex of the triangle to test.</param>
198  /// <param name="vertex2">The second vertex of the triagnle to test.</param>
199  /// <param name="vertex3">The third vertex of the triangle to test.</param>
200  /// <returns>The type of containment the two objects have.</returns>
201  public ContainmentType Contains(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
202  {
203  return Collision.BoxContainsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3);
204  }
205  */
206 
207  /// <summary>
208  /// Determines whether the current objects contains a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/>.
209  /// </summary>
210  /// <param name="box">The box to test.</param>
211  /// <returns>The type of containment the two objects have.</returns>
213  {
214  return Collision.BoxContainsBox(ref this, ref box);
215  }
216 
217  /// <summary>
218  /// Determines whether the current objects contains a <see cref="SiliconStudio.Core.Mathematics.BoundingSphere"/>.
219  /// </summary>
220  /// <param name="sphere">The sphere to test.</param>
221  /// <returns>The type of containment the two objects have.</returns>
223  {
224  return Collision.BoxContainsSphere(ref this, ref sphere);
225  }
226 
227  /// <summary>
228  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> that fully contains the given points.
229  /// </summary>
230  /// <param name="points">The points that will be contained by the box.</param>
231  /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
232  /// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception>
233  public static void FromPoints(Vector3[] points, out BoundingBox result)
234  {
235  if (points == null)
236  throw new ArgumentNullException("points");
237 
238  Vector3 min = new Vector3(float.MaxValue);
239  Vector3 max = new Vector3(float.MinValue);
240 
241  for (int i = 0; i < points.Length; ++i)
242  {
243  Vector3.Min(ref min, ref points[i], out min);
244  Vector3.Max(ref max, ref points[i], out max);
245  }
246 
247  result = new BoundingBox(min, max);
248  }
249 
250  /// <summary>
251  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> that fully contains the given points.
252  /// </summary>
253  /// <param name="points">The points that will be contained by the box.</param>
254  /// <returns>The newly constructed bounding box.</returns>
255  /// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception>
256  public static BoundingBox FromPoints(Vector3[] points)
257  {
258  if (points == null)
259  throw new ArgumentNullException("points");
260 
261  Vector3 min = new Vector3(float.MaxValue);
262  Vector3 max = new Vector3(float.MinValue);
263 
264  for (int i = 0; i < points.Length; ++i)
265  {
266  Vector3.Min(ref min, ref points[i], out min);
267  Vector3.Max(ref max, ref points[i], out max);
268  }
269 
270  return new BoundingBox(min, max);
271  }
272 
273  /// <summary>
274  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> from a given sphere.
275  /// </summary>
276  /// <param name="sphere">The sphere that will designate the extents of the box.</param>
277  /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
278  public static void FromSphere(ref BoundingSphere sphere, out BoundingBox result)
279  {
280  result.Minimum = new Vector3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius);
281  result.Maximum = new Vector3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius);
282  }
283 
284  /// <summary>
285  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> from a given sphere.
286  /// </summary>
287  /// <param name="sphere">The sphere that will designate the extents of the box.</param>
288  /// <returns>The newly constructed bounding box.</returns>
289  public static BoundingBox FromSphere(BoundingSphere sphere)
290  {
291  BoundingBox box;
292  box.Minimum = new Vector3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius);
293  box.Maximum = new Vector3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius);
294  return box;
295  }
296 
297  /// <summary>
298  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> that is as large enough to contains the bounding box and the given point.
299  /// </summary>
300  /// <param name="value1">The box to merge.</param>
301  /// <param name="value2">The point to merge.</param>
302  /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
303  public static void Merge(ref BoundingBox value1, ref Vector3 value2, out BoundingBox result)
304  {
305  Vector3.Min(ref value1.Minimum, ref value2, out result.Minimum);
306  Vector3.Max(ref value1.Maximum, ref value2, out result.Maximum);
307  }
308 
309  /// <summary>
310  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> that is as large as the total combined area of the two specified boxes.
311  /// </summary>
312  /// <param name="value1">The first box to merge.</param>
313  /// <param name="value2">The second box to merge.</param>
314  /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
315  public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)
316  {
317  Vector3.Min(ref value1.Minimum, ref value2.Minimum, out result.Minimum);
318  Vector3.Max(ref value1.Maximum, ref value2.Maximum, out result.Maximum);
319  }
320 
321  /// <summary>
322  /// Constructs a <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> that is as large as the total combined area of the two specified boxes.
323  /// </summary>
324  /// <param name="value1">The first box to merge.</param>
325  /// <param name="value2">The second box to merge.</param>
326  /// <returns>The newly constructed bounding box.</returns>
327  public static BoundingBox Merge(BoundingBox value1, BoundingBox value2)
328  {
329  BoundingBox box;
330  Vector3.Min(ref value1.Minimum, ref value2.Minimum, out box.Minimum);
331  Vector3.Max(ref value1.Maximum, ref value2.Maximum, out box.Maximum);
332  return box;
333  }
334 
335  /// <summary>
336  /// Tests for equality between two objects.
337  /// </summary>
338  /// <param name="left">The first value to compare.</param>
339  /// <param name="right">The second value to compare.</param>
340  /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
341  public static bool operator ==(BoundingBox left, BoundingBox right)
342  {
343  return left.Equals(right);
344  }
345 
346  /// <summary>
347  /// Tests for inequality between two objects.
348  /// </summary>
349  /// <param name="left">The first value to compare.</param>
350  /// <param name="right">The second value to compare.</param>
351  /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
352  public static bool operator !=(BoundingBox left, BoundingBox right)
353  {
354  return !left.Equals(right);
355  }
356 
357  /// <summary>
358  /// Returns a <see cref="System.String"/> that represents this instance.
359  /// </summary>
360  /// <returns>
361  /// A <see cref="System.String"/> that represents this instance.
362  /// </returns>
363  public override string ToString()
364  {
365  return string.Format(CultureInfo.CurrentCulture, "Minimum:{0} Maximum:{1}", Minimum.ToString(), Maximum.ToString());
366  }
367 
368  /// <summary>
369  /// Returns a <see cref="System.String"/> that represents this instance.
370  /// </summary>
371  /// <param name="format">The format.</param>
372  /// <returns>
373  /// A <see cref="System.String"/> that represents this instance.
374  /// </returns>
375  public string ToString(string format)
376  {
377  if (format == null)
378  return ToString();
379 
380  return string.Format(CultureInfo.CurrentCulture, "Minimum:{0} Maximum:{1}", Minimum.ToString(format, CultureInfo.CurrentCulture),
381  Maximum.ToString(format, CultureInfo.CurrentCulture));
382  }
383 
384  /// <summary>
385  /// Returns a <see cref="System.String"/> that represents this instance.
386  /// </summary>
387  /// <param name="formatProvider">The format provider.</param>
388  /// <returns>
389  /// A <see cref="System.String"/> that represents this instance.
390  /// </returns>
391  public string ToString(IFormatProvider formatProvider)
392  {
393  return string.Format(formatProvider, "Minimum:{0} Maximum:{1}", Minimum.ToString(), Maximum.ToString());
394  }
395 
396  /// <summary>
397  /// Returns a <see cref="System.String"/> that represents this instance.
398  /// </summary>
399  /// <param name="format">The format.</param>
400  /// <param name="formatProvider">The format provider.</param>
401  /// <returns>
402  /// A <see cref="System.String"/> that represents this instance.
403  /// </returns>
404  public string ToString(string format, IFormatProvider formatProvider)
405  {
406  if (format == null)
407  return ToString(formatProvider);
408 
409  return string.Format(formatProvider, "Minimum:{0} Maximum:{1}", Minimum.ToString(format, formatProvider),
410  Maximum.ToString(format, formatProvider));
411  }
412 
413  /// <summary>
414  /// Returns a hash code for this instance.
415  /// </summary>
416  /// <returns>
417  /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
418  /// </returns>
419  public override int GetHashCode()
420  {
421  return Minimum.GetHashCode() + Maximum.GetHashCode();
422  }
423 
424  /// <summary>
425  /// Determines whether the specified <see cref="SiliconStudio.Core.Mathematics.Vector4"/> is equal to this instance.
426  /// </summary>
427  /// <param name="value">The <see cref="SiliconStudio.Core.Mathematics.Vector4"/> to compare with this instance.</param>
428  /// <returns>
429  /// <c>true</c> if the specified <see cref="SiliconStudio.Core.Mathematics.Vector4"/> is equal to this instance; otherwise, <c>false</c>.
430  /// </returns>
431  public bool Equals(BoundingBox value)
432  {
433  return Minimum == value.Minimum && Maximum == value.Maximum;
434  }
435 
436  /// <summary>
437  /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
438  /// </summary>
439  /// <param name="value">The <see cref="System.Object"/> to compare with this instance.</param>
440  /// <returns>
441  /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
442  /// </returns>
443  public override bool Equals(object value)
444  {
445  if (value == null)
446  return false;
447 
448  if (value.GetType() != GetType())
449  return false;
450 
451  return Equals((BoundingBox)value);
452  }
453 
454 #if SlimDX1xInterop
455  /// <summary>
456  /// Performs an implicit conversion from <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> to <see cref="SlimDX.BoundingBox"/>.
457  /// </summary>
458  /// <param name="value">The value.</param>
459  /// <returns>The result of the conversion.</returns>
460  public static implicit operator SlimDX.BoundingBox(BoundingBox value)
461  {
462  return new SlimDX.BoundingBox(value.Minimum, value.Maximum);
463  }
464 
465  /// <summary>
466  /// Performs an implicit conversion from <see cref="SlimDX.BoundingBox"/> to <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/>.
467  /// </summary>
468  /// <param name="value">The value.</param>
469  /// <returns>The result of the conversion.</returns>
470  public static implicit operator BoundingBox(SlimDX.BoundingBox value)
471  {
472  return new BoundingBox(value.Minimum, value.Maximum);
473  }
474 #endif
475 
476 #if XnaInterop
477  /// <summary>
478  /// Performs an implicit conversion from <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/> to <see cref="Microsoft.Xna.Framework.BoundingBox"/>.
479  /// </summary>
480  /// <param name="value">The value.</param>
481  /// <returns>The result of the conversion.</returns>
482  public static implicit operator Microsoft.Xna.Framework.BoundingBox(BoundingBox value)
483  {
484  return new Microsoft.Xna.Framework.BoundingBox(value.Minimum, value.Maximum);
485  }
486 
487  /// <summary>
488  /// Performs an implicit conversion from <see cref="Microsoft.Xna.Framework.BoundingBox"/> to <see cref="SiliconStudio.Core.Mathematics.BoundingBox"/>.
489  /// </summary>
490  /// <param name="value">The value.</param>
491  /// <returns>The result of the conversion.</returns>
492  public static implicit operator BoundingBox(Microsoft.Xna.Framework.BoundingBox value)
493  {
494  return new BoundingBox(value.Min, value.Max);
495  }
496 #endif
497  }
498 }
Represents an axis-aligned bounding box in three dimensional space.
Definition: BoundingBox.cs:42
override bool Equals(object value)
Determines whether the specified System.Object is equal to this instance.
Definition: BoundingBox.cs:443
bool Equals(BoundingBox value)
Determines whether the specified SiliconStudio.Core.Mathematics.Vector4 is equal to this instance...
Definition: BoundingBox.cs:431
BoundingBox(Vector3 minimum, Vector3 maximum)
Initializes a new instance of the SiliconStudio.Core.Mathematics.BoundingBox struct.
Definition: BoundingBox.cs:64
string ToString(string format)
Returns a System.String that represents this instance.
Definition: BoundingBox.cs:375
float Y
The Y component of the vector.
Definition: Vector3.cs:84
bool Intersects(ref Ray ray)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.Ray.
Definition: BoundingBox.cs:109
override int GetHashCode()
Returns a hash code for this instance.
Definition: BoundingBox.cs:419
bool Intersects(ref BoundingBox box)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.BoundingBox.
Definition: BoundingBox.cs:168
static BoundingBox Merge(BoundingBox value1, BoundingBox value2)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox that is as large as the total combined area o...
Definition: BoundingBox.cs:327
float X
The X component of the vector.
Definition: Vector3.cs:78
Represents a three dimensional mathematical vector.
Definition: Vector3.cs:42
ContainmentType Contains(ref Vector3 point)
Determines whether the current objects contains a point.
Definition: BoundingBox.cs:188
override string ToString()
Returns a System.String that represents this instance.
Definition: BoundingBox.cs:363
static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox that is as large as the total combined area o...
Definition: BoundingBox.cs:315
Vector3 Minimum
The minimum point of the box.
Definition: BoundingBox.cs:52
Represents a bounding sphere in three dimensional space.
static void FromPoints(Vector3[] points, out BoundingBox result)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox that fully contains the given points...
Definition: BoundingBox.cs:233
PlaneIntersectionType Intersects(ref Plane plane)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.Plane.
Definition: BoundingBox.cs:144
static void FromSphere(ref BoundingSphere sphere, out BoundingBox result)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox from a given sphere.
Definition: BoundingBox.cs:278
bool Intersects(ref BoundingSphere sphere)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.BoundingSphere.
Definition: BoundingBox.cs:178
Represents a plane in three dimensional space.
Definition: Plane.cs:42
ContainmentType
Describes how one bounding volume contains another.
Vector3 Center
The center of the sphere in three dimensional space.
static BoundingBox FromPoints(Vector3[] points)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox that fully contains the given points...
Definition: BoundingBox.cs:256
Vector3 Maximum
The maximum point of the box.
Definition: BoundingBox.cs:57
Represents a three dimensional line based on a point in space and a direction.
Definition: Ray.cs:42
PlaneIntersectionType
Describes the result of an intersection with a plane in three dimensions.
string ToString(IFormatProvider formatProvider)
Returns a System.String that represents this instance.
Definition: BoundingBox.cs:391
bool Intersects(ref Ray ray, out float distance)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.Ray.
Definition: BoundingBox.cs:122
SiliconStudio.Core.Mathematics.Vector3 Vector3
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
Definition: DirectXTexP.h:175
float Z
The Z component of the vector.
Definition: Vector3.cs:90
Vector3[] GetCorners()
Retrieves the eight corners of the bounding box.
Definition: BoundingBox.cs:90
bool Intersects(ref Ray ray, out Vector3 point)
Determines if there is an intersection between the current object and a SiliconStudio.Core.Mathematics.Ray.
Definition: BoundingBox.cs:134
ContainmentType Contains(ref BoundingSphere sphere)
Determines whether the current objects contains a SiliconStudio.Core.Mathematics.BoundingSphere.
Definition: BoundingBox.cs:222
ContainmentType Contains(ref BoundingBox box)
Determines whether the current objects contains a SiliconStudio.Core.Mathematics.BoundingBox.
Definition: BoundingBox.cs:212
string ToString(string format, IFormatProvider formatProvider)
Returns a System.String that represents this instance.
Definition: BoundingBox.cs:404
static BoundingBox FromSphere(BoundingSphere sphere)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox from a given sphere.
Definition: BoundingBox.cs:289
float Radius
The radious of the sphere.
static void Merge(ref BoundingBox value1, ref Vector3 value2, out BoundingBox result)
Constructs a SiliconStudio.Core.Mathematics.BoundingBox that is as large enough to contains the bound...
Definition: BoundingBox.cs:303