Class BoundingSphereD
Defines a sphere.
Inheritance
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingSphereD : ValueType, IEquatable<BoundingSphereD>
Constructors
BoundingSphereD(Vector3D, Double)
Creates a new instance of BoundingSphereD.
Declaration
public BoundingSphereD(Vector3D center, double radius)
Parameters
Type | Name | Description |
---|---|---|
Vector3D | center | Center point of the sphere. |
System.Double | radius | Radius of the sphere. |
Fields
Center
The center point of the sphere.
Declaration
public Vector3D Center
Field Value
Type | Description |
---|---|
Vector3D |
Radius
The radius of the sphere.
Declaration
public double Radius
Field Value
Type | Description |
---|---|
System.Double |
Methods
Contains(BoundingBoxD)
Checks whether the current BoundingSphereD contains the specified BoundingBoxD.
Declaration
public ContainmentType Contains(BoundingBoxD box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to check against the current BoundingSphereD. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref BoundingBoxD, out ContainmentType)
Checks whether the current BoundingSphereD contains the specified BoundingBoxD.
Declaration
public void Contains(ref BoundingBoxD box, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
Contains(BoundingFrustumD)
Checks whether the current BoundingSphereD contains the specified BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustumD frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustumD | frustum | The BoundingFrustum to check against the current BoundingSphereD. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(BoundingSphereD)
Checks whether the current BoundingSphereD contains the specified BoundingSphereD.
Declaration
public ContainmentType Contains(BoundingSphereD sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere | The BoundingSphereD to check against the current BoundingSphereD. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref BoundingSphereD, out ContainmentType)
Checks whether the current BoundingSphereD contains the specified BoundingSphereD.
Declaration
public void Contains(ref BoundingSphereD sphere, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere | The BoundingSphereD to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
Contains(MyOrientedBoundingBoxD)
Checks whether the current BoundingSphereD contains the specified MyOrientedBoundingBoxD.
Declaration
public ContainmentType Contains(MyOrientedBoundingBoxD obox)
Parameters
Type | Name | Description |
---|---|---|
MyOrientedBoundingBoxD | obox | The MyOrientedBoundingBoxD to check against the current BoundingSphereD. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref MyOrientedBoundingBoxD, out ContainmentType)
Checks whether the current BoundingSphereD contains the specified MyOrientedBoundingBoxD.
Declaration
public void Contains(ref MyOrientedBoundingBoxD obox, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
MyOrientedBoundingBoxD | obox | The MyOrientedBoundingBoxD to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
Contains(Vector3D)
Checks whether the current BoundingSphereD contains the specified point.
Declaration
public ContainmentType Contains(Vector3D point)
Parameters
Type | Name | Description |
---|---|---|
Vector3D | point | The point to check against the current BoundingSphereD. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref Vector3D, out ContainmentType)
Checks whether the current BoundingSphereD contains the specified point.
Declaration
public void Contains(ref Vector3D point, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
Vector3D | point | The point to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
CreateFromBoundingBox(BoundingBoxD)
Creates the smallest BoundingSphereD that can contain a specified BoundingBoxD.
Declaration
public static BoundingSphereD CreateFromBoundingBox(BoundingBoxD box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to create the BoundingSphereD from. |
Returns
Type | Description |
---|---|
BoundingSphereD |
CreateFromBoundingBox(ref BoundingBoxD, out BoundingSphereD)
Creates the smallest BoundingSphereD that can contain a specified BoundingBoxD.
Declaration
public static void CreateFromBoundingBox(ref BoundingBoxD box, out BoundingSphereD result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to create the BoundingSphereD from. |
BoundingSphereD | result | [OutAttribute] The created BoundingSphereD. |
CreateFromFrustum(BoundingFrustumD)
Creates the smallest BoundingSphereD that can contain a specified BoundingFrustum.
Declaration
public static BoundingSphereD CreateFromFrustum(BoundingFrustumD frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustumD | frustum | The BoundingFrustum to create the BoundingSphereD with. |
Returns
Type | Description |
---|---|
BoundingSphereD |
CreateFromPoints(Vector3D[])
Creates a BoundingSphereD that can contain a specified list of points.
Declaration
public static BoundingSphereD CreateFromPoints(Vector3D[] points)
Parameters
Type | Name | Description |
---|---|---|
Vector3D[] | points | List of points the BoundingSphereD must contain. |
Returns
Type | Description |
---|---|
BoundingSphereD |
CreateInvalid()
Declaration
public static BoundingSphereD CreateInvalid()
Returns
Type | Description |
---|---|
BoundingSphereD |
CreateMerged(BoundingSphereD, BoundingSphereD)
Creates a BoundingSphereD that contains the two specified BoundingSphereD instances.
Declaration
public static BoundingSphereD CreateMerged(BoundingSphereD original, BoundingSphereD additional)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | original | BoundingSphereD to be merged. |
BoundingSphereD | additional | BoundingSphereD to be merged. |
Returns
Type | Description |
---|---|
BoundingSphereD |
CreateMerged(ref BoundingSphereD, ref BoundingSphereD, out BoundingSphereD)
Creates a BoundingSphereD that contains the two specified BoundingSphereD instances.
Declaration
public static void CreateMerged(ref BoundingSphereD original, ref BoundingSphereD additional, out BoundingSphereD result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | original | BoundingSphereD to be merged. |
BoundingSphereD | additional | BoundingSphereD to be merged. |
BoundingSphereD | result | [OutAttribute] The created BoundingSphereD. |
Equals(Object)
Determines whether the specified Object is equal to the BoundingSphereD.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The Object to compare with the current BoundingSphereD. |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(BoundingSphereD)
Determines whether the specified BoundingSphereD is equal to the current BoundingSphereD.
Declaration
public bool Equals(BoundingSphereD other)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | other | The BoundingSphereD to compare with the current BoundingSphereD. |
Returns
Type | Description |
---|---|
System.Boolean |
GetBoundingBox()
Declaration
public BoundingBoxD GetBoundingBox()
Returns
Type | Description |
---|---|
BoundingBoxD |
GetHashCode()
Gets the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Include(BoundingSphereD)
Declaration
public BoundingSphereD Include(BoundingSphereD sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere |
Returns
Type | Description |
---|---|
BoundingSphereD |
Include(ref BoundingSphereD, ref BoundingSphereD)
Declaration
public static void Include(ref BoundingSphereD sphere, ref BoundingSphereD otherSphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere | |
BoundingSphereD | otherSphere |
IntersectRaySphere(RayD, out Double, out Double)
NOTE: This function doesn't calculate the normal because it's easily derived for a sphere (p - center).
Declaration
public bool IntersectRaySphere(RayD ray, out double tmin, out double tmax)
Parameters
Type | Name | Description |
---|---|---|
RayD | ray | |
System.Double | tmin | |
System.Double | tmax |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(BoundingBoxD)
Checks whether the current BoundingSphereD intersects with a specified BoundingBoxD.
Declaration
public bool Intersects(BoundingBoxD box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to check for intersection with the current BoundingSphereD. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(ref BoundingBoxD, out Boolean)
Checks whether the current BoundingSphereD intersects a BoundingBoxD.
Declaration
public void Intersects(ref BoundingBoxD box, out bool result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBoxD | box | The BoundingBoxD to check for intersection with. |
System.Boolean | result | [OutAttribute] true if the BoundingSphereD and BoundingBoxD intersect; false otherwise. |
Intersects(BoundingFrustumD)
Checks whether the current BoundingSphereD intersects with a specified BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustumD frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustumD | frustum | The BoundingFrustum to check for intersection with the current BoundingSphereD. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(BoundingSphereD)
Checks whether the current BoundingSphereD intersects with a specified BoundingSphereD.
Declaration
public bool Intersects(BoundingSphereD sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere | The BoundingSphereD to check for intersection with the current BoundingSphereD. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(ref BoundingSphereD, out Boolean)
Checks whether the current BoundingSphereD intersects another BoundingSphereD.
Declaration
public void Intersects(ref BoundingSphereD sphere, out bool result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | sphere | The BoundingSphereD to check for intersection with. |
System.Boolean | result | [OutAttribute] true if the BoundingSphereD instances intersect; false otherwise. |
Intersects(RayD)
Declaration
public Nullable<double> Intersects(RayD ray)
Parameters
Type | Name | Description |
---|---|---|
RayD | ray |
Returns
Type | Description |
---|---|
System.Nullable<System.Double> |
RandomToUniformPointInSphere(Double, Double, Double)
If ranX, ranY, ranZ are uniformly distributed across ranges <0,1>, Resulting point will be uniformly distributed inside sphere
Declaration
public Vector3D RandomToUniformPointInSphere(double ranX, double ranY, double ranZ)
Parameters
Type | Name | Description |
---|---|---|
System.Double | ranX | Random number in <0,1> affecting azimuth |
System.Double | ranY | Random number in <0,1> affecting altitude |
System.Double | ranZ | Random number in <0,1> affecting distance from center |
Returns
Type | Description |
---|---|
Vector3D |
RandomToUniformPointInSphereWithInnerCutout(Double, Double, Double, Double)
Similar to RandomToUniformPointInSphere(...) but excludes points within distance of cutoutRadius from center. (Results are randomly distributed in the shape that remains from sphere that had another sphere cut out from center. )
Declaration
public Nullable<Vector3D> RandomToUniformPointInSphereWithInnerCutout(double ranX, double ranY, double ranZ, double cutoutRadius)
Parameters
Type | Name | Description |
---|---|---|
System.Double | ranX | |
System.Double | ranY | |
System.Double | ranZ | |
System.Double | cutoutRadius |
Returns
Type | Description |
---|---|
System.Nullable<Vector3D> |
RandomToUniformPointOnSphere(Double, Double)
Declaration
public Vector3D RandomToUniformPointOnSphere(double ranX, double ranY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | ranX | |
System.Double | ranY |
Returns
Type | Description |
---|---|
Vector3D |
ToString()
Returns a String that represents the current BoundingSphereD.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Transform(MatrixD)
Translates and scales the BoundingSphereD using a given Matrix.
Declaration
public BoundingSphereD Transform(MatrixD matrix)
Parameters
Type | Name | Description |
---|---|---|
MatrixD | matrix | A transformation matrix that might include translation, rotation, or uniform scaling. Note that BoundingSphereD.Transform will not return correct results if there are non-uniform scaling, shears, or other unusual transforms in this transformation matrix. This is because there is no way to shear or non-uniformly scale a sphere. Such an operation would cause the sphere to lose its shape as a sphere. |
Returns
Type | Description |
---|---|
BoundingSphereD |
Transform(ref MatrixD, out BoundingSphereD)
Translates and scales the BoundingSphereD using a given Matrix.
Declaration
public void Transform(ref MatrixD matrix, out BoundingSphereD result)
Parameters
Type | Name | Description |
---|---|---|
MatrixD | matrix | A transformation matrix that might include translation, rotation, or uniform scaling. Note that BoundingSphereD.Transform will not return correct results if there are non-uniform scaling, shears, or other unusual transforms in this transformation matrix. This is because there is no way to shear or non-uniformly scale a sphere. Such an operation would cause the sphere to lose its shape as a sphere. |
BoundingSphereD | result | [OutAttribute] The transformed BoundingSphereD. |
Operators
Equality(BoundingSphereD, BoundingSphereD)
Determines whether two instances of BoundingSphereD are equal.
Declaration
public static bool operator ==(BoundingSphereD a, BoundingSphereD b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | a | The object to the left of the equality operator. |
BoundingSphereD | b | The object to the right of the equality operator. |
Returns
Type | Description |
---|---|
System.Boolean |
Implicit(BoundingSphere to BoundingSphereD)
Declaration
public static implicit operator BoundingSphereD(BoundingSphere b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | b |
Returns
Type | Description |
---|---|
BoundingSphereD |
Implicit(BoundingSphereD to BoundingSphere)
Declaration
public static implicit operator BoundingSphere(BoundingSphereD b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | b |
Returns
Type | Description |
---|---|
BoundingSphere |
Inequality(BoundingSphereD, BoundingSphereD)
Determines whether two instances of BoundingSphereD are not equal.
Declaration
public static bool operator !=(BoundingSphereD a, BoundingSphereD b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphereD | a | The BoundingSphereD to the left of the inequality operator. |
BoundingSphereD | b | The BoundingSphereD to the right of the inequality operator. |
Returns
Type | Description |
---|---|
System.Boolean |