Struct BoundingFrustum
A bounding frustum object.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.DXMath.Collision
Assembly: JeremyAnsel.DirectX.DXMath.dll
Syntax
public struct BoundingFrustum : IEquatable<BoundingFrustum>
Constructors
| Edit this page View SourceBoundingFrustum(XMFloat3, XMFloat4, float, float, float, float, float, float)
Initializes a new instance of the BoundingFrustum struct.
Declaration
public BoundingFrustum(XMFloat3 origin, XMFloat4 orientation, float rightSlope, float leftSlope, float topSlope, float bottomSlope, float near, float far)
Parameters
| Type | Name | Description |
|---|---|---|
| XMFloat3 | origin | The origin of the frustum. |
| XMFloat4 | orientation | The orientation of the frustum. |
| float | rightSlope | The slope of the right side of the frustum. |
| float | leftSlope | The slope of the left side of the frustum. |
| float | topSlope | The slope of the top of the frustum. |
| float | bottomSlope | The slope of the bottom of the frustum. |
| float | near | The distance of the near plane from the origin of the frustum. |
| float | far | The distance of the far plane from the origin of the frustum. |
BoundingFrustum(XMMatrix)
Initializes a new instance of the BoundingFrustum struct from a left-handed projection matrix..
Declaration
public BoundingFrustum(XMMatrix projection)
Parameters
| Type | Name | Description |
|---|---|---|
| XMMatrix | projection | The left-handed projection matrix to create the frustum from. |
Fields
| Edit this page View SourceCornerCount
The number of corners defining the BoundingFrustum.
Declaration
public const int CornerCount = 8
Field Value
| Type | Description |
|---|---|
| int |
Properties
| Edit this page View SourceBottomSlope
Gets or sets the slope of the bottom of the BoundingFrustum.
Declaration
public float BottomSlope { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Far
Gets or sets the distance of the far plane from the origin of the BoundingFrustum.
Declaration
public float Far { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
LeftSlope
Gets or sets the slope of the left side of the BoundingFrustum.
Declaration
public float LeftSlope { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Near
Gets or sets the distance of the near plane of the BoundingFrustum from its origin.
Declaration
public float Near { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Orientation
Gets or sets the orientation of the BoundingFrustum represented as a quaternion.
Declaration
public XMFloat4 Orientation { get; set; }
Property Value
| Type | Description |
|---|---|
| XMFloat4 |
Origin
Gets or sets the origin of the BoundingFrustum.
Declaration
public XMFloat3 Origin { get; set; }
Property Value
| Type | Description |
|---|---|
| XMFloat3 |
RightSlope
Gets or sets the slope of the right side of the BoundingFrustum.
Declaration
public float RightSlope { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
TopSlope
Gets or sets the slope of the top of the BoundingFrustum.
Declaration
public float TopSlope { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceContainedBy(XMVector, XMVector, XMVector, XMVector, XMVector, XMVector)
Tests whether the BoundingFrustum is contained by the specified frustum.
Declaration
public ContainmentType ContainedBy(XMVector plane0, XMVector plane1, XMVector plane2, XMVector plane3, XMVector plane4, XMVector plane5)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | plane0 | The first plane describing the frustum. |
| XMVector | plane1 | The second plane describing the frustum. |
| XMVector | plane2 | The third plane describing the frustum. |
| XMVector | plane3 | The fourth plane describing the frustum. |
| XMVector | plane4 | The fifth plane describing the frustum. |
| XMVector | plane5 | The sixth plane describing the frustum. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the frustum contains the BoundingFrustum. |
ContainedBy(XMVector[]?)
Tests whether the BoundingFrustum is contained by the specified frustum.
Declaration
public ContainmentType ContainedBy(XMVector[]? planes)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector[] | planes | The planes describing the frustum. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the frustum contains the BoundingFrustum. |
Contains(BoundingBox)
Tests whether the BoundingFrustum contains the specified BoundingBox.
Declaration
public ContainmentType Contains(BoundingBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | The BoundingBox to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingBox is contained in the BoundingFrustum. |
Contains(BoundingFrustum)
Tests whether the BoundingFrustum contains the specified BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustum fr)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | fr | The BoundingFrustum to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingFrustum is contained in the BoundingFrustum. |
Contains(BoundingOrientedBox)
Tests whether the BoundingFrustum contains the specified BoundingOrientedBox.
Declaration
public ContainmentType Contains(BoundingOrientedBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingOrientedBox | box | The BoundingOrientedBox to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingOrientedBox is contained in the BoundingFrustum. |
Contains(BoundingSphere)
Tests whether the BoundingFrustum contains the specified BoundingSphere.
Declaration
public ContainmentType Contains(BoundingSphere sh)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | sh | The BoundingSphere to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingSphere is contained in the BoundingFrustum. |
Contains(XMVector)
Tests whether the BoundingFrustum contains the specified point.
Declaration
public ContainmentType Contains(XMVector point)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | point | The point to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the point is contained in the BoundingFrustum. |
Contains(XMVector, XMVector, XMVector)
Tests whether the BoundingFrustum contains the specified triangle.
Declaration
public ContainmentType Contains(XMVector v0, XMVector v1, XMVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | v0 | The first corner of the triangle. |
| XMVector | v1 | The second corner of the triangle. |
| XMVector | v2 | The third corner of the triangle. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the triangle is contained in the BoundingFrustum. |
CreateFromMatrix(XMMatrix)
Creates a BoundingFrustum from the specified projection matrix.
Declaration
public static BoundingFrustum CreateFromMatrix(XMMatrix projection)
Parameters
| Type | Name | Description |
|---|---|---|
| XMMatrix | projection | The left-handed projection matrix to create the BoundingFrustum from. |
Returns
| Type | Description |
|---|---|
| BoundingFrustum | The new BoundingFrustum. |
Equals(BoundingFrustum)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(BoundingFrustum other)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | other | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceGetCorners()
Gets the corners making up the BoundingFrustum.
Declaration
public XMFloat3[] GetCorners()
Returns
| Type | Description |
|---|---|
| XMFloat3[] | The corners. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceGetPlanes(out XMVector, out XMVector, out XMVector, out XMVector, out XMVector, out XMVector)
Gets the planes making up the BoundingFrustum.
Declaration
public void GetPlanes(out XMVector nearPlane, out XMVector farPlane, out XMVector rightPlane, out XMVector leftPlane, out XMVector topPlane, out XMVector bottomPlane)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | nearPlane | The near plane. |
| XMVector | farPlane | The far plane. |
| XMVector | rightPlane | The right plane. |
| XMVector | leftPlane | The left plane. |
| XMVector | topPlane | The top plane. |
| XMVector | bottomPlane | The bottom plane. |
Intersects(BoundingBox)
Test the BoundingFrustum for intersection with a BoundingBox.
Declaration
public bool Intersects(BoundingBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | The BoundingBox to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects the specified BoundingBox. |
Intersects(BoundingFrustum)
Test the BoundingFrustum for intersection with another BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustum fr)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | fr | The BoundingFrustum to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects the specified BoundingFrustum. |
Intersects(BoundingOrientedBox)
Test the BoundingFrustum for intersection with a BoundingOrientedBox.
Declaration
public bool Intersects(BoundingOrientedBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingOrientedBox | box | The BoundingOrientedBox to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects the specified BoundingOrientedBox. |
Intersects(BoundingSphere)
Test the BoundingFrustum for intersection with a BoundingSphere.
Declaration
public bool Intersects(BoundingSphere sh)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | sh | The BoundingSphere to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects the specified BoundingSphere. |
Intersects(XMVector)
Test the BoundingFrustum for intersection with a plane.
Declaration
public PlaneIntersectionType Intersects(XMVector plane)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | plane | A vector describing the plane. |
Returns
| Type | Description |
|---|---|
| PlaneIntersectionType | A PlaneIntersectionType value indicating the intersection status. |
Intersects(XMVector, XMVector)
Test the BoundingFrustum for intersection with a ray.
Declaration
public bool Intersects(XMVector rayOrigin, XMVector direction)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | rayOrigin | The origin of the ray. |
| XMVector | direction | The direction of the ray. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects with the ray. |
Intersects(XMVector, XMVector, XMVector)
Test the BoundingFrustum for intersection with a triangle.
Declaration
public bool Intersects(XMVector v0, XMVector v1, XMVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | v0 | The first vector describing the triangle. |
| XMVector | v1 | The second vector describing the triangle. |
| XMVector | v2 | The third vector describing the triangle. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects the triangle. |
Intersects(XMVector, XMVector, out float)
Test the BoundingFrustum for intersection with a ray.
Declaration
public bool Intersects(XMVector rayOrigin, XMVector direction, out float dist)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | rayOrigin | The origin of the ray. |
| XMVector | direction | The direction of the ray. |
| float | dist | The length of the ray. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingFrustum intersects with the ray. |
Transform(XMMatrix)
Transforms the BoundingFrustum by the specified transformation matrix.
Declaration
public BoundingFrustum Transform(XMMatrix m)
Parameters
| Type | Name | Description |
|---|---|---|
| XMMatrix | m | The transformation matrix. |
Returns
| Type | Description |
|---|---|
| BoundingFrustum | The transformed BoundingFrustum. |
Transform(float, XMVector, XMVector)
Transforms the BoundingFrustum using the specified scale, rotation and translation vectors.
Declaration
public BoundingFrustum Transform(float scale, XMVector rotation, XMVector translation)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scale | The value to scale the BoundingFrustum by. |
| XMVector | rotation | The value to rotate the BoundingFrustum by. |
| XMVector | translation | The value to translate the BoundingFrustum by. |
Returns
| Type | Description |
|---|---|
| BoundingFrustum | The transformed BoundingFrustum. |
Operators
| Edit this page View Sourceoperator ==(BoundingFrustum, BoundingFrustum)
Compares two BoundingFrustum objects. The result specifies whether the values of the two objects are equal.
Declaration
public static bool operator ==(BoundingFrustum left, BoundingFrustum right)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | left | The left BoundingFrustum to compare. |
| BoundingFrustum | right | The right BoundingFrustum to compare. |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(BoundingFrustum, BoundingFrustum)
Compares two BoundingFrustum objects. The result specifies whether the values of the two objects are unequal.
Declaration
public static bool operator !=(BoundingFrustum left, BoundingFrustum right)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | left | The left BoundingFrustum to compare. |
| BoundingFrustum | right | The right BoundingFrustum to compare. |
Returns
| Type | Description |
|---|---|
| bool |