Struct AABBf
Represents an axis aligned bounding box.
Inherited Members
Namespace: Fusee.Math.Core
Assembly: Fusee.Math.Core.dll
Syntax
public struct AABBf
Constructors
AABBf(float3, float3)
Create a new axis aligned bounding box.
Declaration
public AABBf(float3 min_, float3 max_)
Parameters
Type | Name | Description |
---|---|---|
float3 | min_ | the minimum x y and z values. |
float3 | max_ | the maximum x y and z values. |
AABBf(ReadOnlySpan<float3>)
Create a new axis aligned bounding box.
Declaration
public AABBf(ReadOnlySpan<float3> vertices)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<float3> | vertices | The list of vertices the bounding box is created for. |
Fields
max
The maximum values of the axis aligned bounding box in x, y and z direction
Declaration
public float3 max
Field Value
Type | Description |
---|---|
float3 |
min
The minimum values of the axis aligned bounding box in x, y and z direction
Declaration
public float3 min
Field Value
Type | Description |
---|---|
float3 |
Properties
Center
Returns the center of the bounding box
Declaration
public readonly float3 Center { get; }
Property Value
Type | Description |
---|---|
float3 |
Size
Returns the with, height and depth of the box in x, y and z
Declaration
public readonly float3 Size { get; }
Property Value
Type | Description |
---|---|
float3 |
Methods
Equals(Object)
Indicates whether this AABBf is equal to another object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object. This method will throw an exception if the object isn't of type AABBf. |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
GetHashCode()
Generates a hash code for this AABBf.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
InsideOrIntersectingFrustum(FrustumF)
Checks if a viewing frustum lies within or intersects this AABB.
Declaration
public bool InsideOrIntersectingFrustum(FrustumF frustum)
Parameters
Type | Name | Description |
---|---|---|
FrustumF | frustum | The frustum to test against. |
Returns
Type | Description |
---|---|
System.Boolean | false if fully outside, true if inside or intersecting. |
InsideOrIntersectingPlane(PlaneF)
Checks if a plane lies within or intersects this AABB.
Declaration
public bool InsideOrIntersectingPlane(PlaneF plane)
Parameters
Type | Name | Description |
---|---|---|
PlaneF | plane | The plane to test against. |
Returns
Type | Description |
---|---|
System.Boolean | false if fully outside, true if inside or intersecting. |
IntersectRay(RayF)
Checks if a given ray originates in, or intersects this AABB.
Declaration
public bool IntersectRay(RayF ray)
Parameters
Type | Name | Description |
---|---|---|
RayF | ray | The ray to test against. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(AABBf)
Check if this AABB intersects with another
Declaration
public bool Intersects(AABBf b)
Parameters
Type | Name | Description |
---|---|---|
AABBf | b |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(AABBf, AABBf)
Check if two AABBs intersect each other
Declaration
public static bool Intersects(AABBf left, AABBf right)
Parameters
Type | Name | Description |
---|---|---|
AABBf | left | |
AABBf | right |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(AABBf, float3)
Check if a point lies within a AABB
Declaration
public static bool Intersects(AABBf aabb, float3 point)
Parameters
Type | Name | Description |
---|---|---|
AABBf | aabb | |
float3 | point |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(float3)
Check if point lies in this AABB
Declaration
public bool Intersects(float3 point)
Parameters
Type | Name | Description |
---|---|---|
float3 | point |
Returns
Type | Description |
---|---|
System.Boolean |
Union(AABBf, AABBf)
Calculates the bounding box around two existing bounding boxes.
Declaration
public static AABBf Union(AABBf a, AABBf b)
Parameters
Type | Name | Description |
---|---|---|
AABBf | a | One of the bounding boxes to build the union from |
AABBf | b | The other bounding box to build the union from |
Returns
Type | Description |
---|---|
AABBf | The smallest axis aligned bounding box containing both input boxes |
Union(AABBf, float3)
Calculates the bounding box around an existing bounding box and a single point.
Declaration
public static AABBf Union(AABBf a, float3 p)
Parameters
Type | Name | Description |
---|---|---|
AABBf | a | The bounding boxes to build the union from. |
float3 | p | The point to be enclosed by the resulting bounding box |
Returns
Type | Description |
---|---|
AABBf | The smallest axis aligned bounding box containing the input box and the point. |
Operators
BitwiseOr(AABBf, AABBf)
Calculates the bounding box around two existing bounding boxes.
Declaration
public static AABBf operator |(AABBf a, AABBf b)
Parameters
Type | Name | Description |
---|---|---|
AABBf | a | One of the bounding boxes to build the union from |
AABBf | b | The other bounding box, to build the union from |
Returns
Type | Description |
---|---|
AABBf | The smallest axis aligned bounding box containing both input boxes |
BitwiseOr(AABBf, float3)
Calculates the bounding box around an existing bounding box and a single point.
Declaration
public static AABBf operator |(AABBf a, float3 p)
Parameters
Type | Name | Description |
---|---|---|
AABBf | a | The bounding boxes to build the union from. |
float3 | p | The point to be enclosed by the resulting bounding box |
Returns
Type | Description |
---|---|
AABBf | The smallest axis aligned bounding box containing the input box and the point. |
Examples
Use this operator e.g. to calculate the bounding box for a given list of points.
AABB box = new AABB(pointList.First(), pointList.First());
foreach (float3 p in pointList)
box |= p;
Equality(AABBf, AABBf)
Operator override for equality.
Declaration
public static bool operator ==(AABBf left, AABBf right)
Parameters
Type | Name | Description |
---|---|---|
AABBf | left | The AABBf. |
AABBf | right | The scalar value. |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(AABBf, AABBf)
Operator override for inequality.
Declaration
public static bool operator !=(AABBf left, AABBf right)
Parameters
Type | Name | Description |
---|---|---|
AABBf | left | The AABBf. |
AABBf | right | The scalar value. |
Returns
Type | Description |
---|---|
System.Boolean |
Multiply(float4x4, AABBf)
Applies a transformation on the bounding box. After the transformation another axis aligned bounding box results. This is done by transforming all eight vertices of the box and re-aligning to the axes afterwards.
Declaration
public static AABBf operator *(float4x4 m, AABBf box)
Parameters
Type | Name | Description |
---|---|---|
float4x4 | m | The transformation matrix. |
AABBf | box | the box to transform. |
Returns
Type | Description |
---|---|
AABBf | A new axis aligned bounding box. |