Struct BBox3
An axis-aligned bounding box.
Inherited Members
Namespace: Elements.Geometry
Assembly: Hypar.Elements.dll
Syntax
[JsonConverter(typeof(JsonInheritanceConverter), new object[]{"discriminator"})]
public struct BBox3
Constructors
BBox3(Element)
Create the BBox3 for an Element. Elements without any geometry will return invalid boxes. Properties of the element that are themselves elements will not be considered.
Declaration
public BBox3(Element element)
Parameters
Type | Name | Description |
---|---|---|
Element | element | The element. |
BBox3(Profile)
Create the BBox3 for a Profile.
Declaration
public BBox3(Profile profile)
Parameters
Type | Name | Description |
---|---|---|
Profile | profile | The Profile. |
BBox3(Vector3, Vector3)
Create a bounding box.
Declaration
[JsonConstructor]
public BBox3(Vector3 min, Vector3 max)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | min | The minimum point. |
Vector3 | max | The maximum point. |
BBox3(IEnumerable<Vector3>)
Construct a bounding box from an array of points.
Declaration
public BBox3(IEnumerable<Vector3> points)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Vector3> | points | The points which are contained within the bounding box. |
BBox3(IList<Polygon>)
Create a bounding box for a collection of polygons.
Declaration
public BBox3(IList<Polygon> polygons)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Polygon> | polygons |
Properties
Max
The maximum extent of the bounding box.
Declaration
[JsonProperty("Max", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
public Vector3 Max { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Min
The minimum extent of the bounding box.
Declaration
[JsonProperty("Min", Required = Required.Default, NullValueHandling = NullValueHandling.Ignore)]
public Vector3 Min { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Volume
The volume of the bounding box.
Declaration
[JsonIgnore]
public readonly double Volume { get; }
Property Value
Type | Description |
---|---|
System.Double |
XDomain
A domain representing the x extents of the bounding box.
Declaration
[JsonIgnore]
public readonly Domain1d XDomain { get; }
Property Value
Type | Description |
---|---|
Domain1d |
XSize
The x dimension of the bounding box.
Declaration
[JsonIgnore]
public readonly double XSize { get; }
Property Value
Type | Description |
---|---|
System.Double |
YDomain
A domain representing the y extents of the bounding box.
Declaration
[JsonIgnore]
public readonly Domain1d YDomain { get; }
Property Value
Type | Description |
---|---|
Domain1d |
YSize
The y dimension of the bounding box.
Declaration
[JsonIgnore]
public readonly double YSize { get; }
Property Value
Type | Description |
---|---|
System.Double |
ZDomain
A domain representing the z extents of the bounding box.
Declaration
[JsonIgnore]
public readonly Domain1d ZDomain { get; }
Property Value
Type | Description |
---|---|
Domain1d |
ZSize
The z dimension of the bounding box.
Declaration
[JsonIgnore]
public readonly double ZSize { get; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
Center()
Get the center of the bounding box.
Declaration
public Vector3 Center()
Returns
Type | Description |
---|---|
Vector3 | The center of the bounding box. |
Contains(Vector3)
Does this bounding box contain the provided point?
Declaration
public bool Contains(Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to test. |
Returns
Type | Description |
---|---|
System.Boolean | True if the bounding box contains the point, otherwise false. |
Corners()
Get all 8 corners of this bounding box. Ordering is CCW bottom, then CCW top, each starting from minimum (X,Y). For a unit cube this would be: (0,0,0),(1,0,0),(1,1,0),(0,1,0),(0,0,1),(1,0,1),(1,1,1),(0,1,1)
Declaration
public List<Vector3> Corners()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Vector3> | The corners of the bounding box. |
Equals(Object)
Is the provided object a bounding box? If so, is it equal to this bounding box within Epsilon?
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Extend(Vector3)
Extend this bounding box to contain the specified point.
Declaration
public void Extend(Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to include in the bounding box. |
Extend(Vector3[])
Extend this bound box to contain the specified points.
Declaration
public void Extend(params Vector3[] points)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | points | The points to include in the bounding box. |
GetHashCode()
Get the hash code for the bounding box.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Intersects(BBox3)
Does this bounding box intersect the other bounding box?
Declaration
public bool Intersects(BBox3 other)
Parameters
Type | Name | Description |
---|---|---|
BBox3 | other | The bounding box to test. |
Returns
Type | Description |
---|---|
System.Boolean | True if an intersection occurs, otherwise false. |
Intersects(Plane, out RelationToPlane, Transform)
Does the bounding box intersect the provided plane?
Declaration
public bool Intersects(Plane plane, out RelationToPlane relationToPlane, Transform transform = null)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The plane. |
RelationToPlane | relationToPlane | The relation of the bounding box to the plane. |
Transform | transform | An optional transform of the bounding box to apply before intersection. |
Returns
Type | Description |
---|---|
System.Boolean | True if the bounding box intersects, otherwise false. |
IsDegenerate()
Does this bounding box have a dimension of 0 along any axis?
Declaration
public bool IsDegenerate()
Returns
Type | Description |
---|---|
System.Boolean |
IsValid()
Does this bounding box have a valid set value?
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
System.Boolean |
Offset(Double)
Offset a box in each coordinate by a given amount.
Declaration
public BBox3 Offset(double amount)
Parameters
Type | Name | Description |
---|---|---|
System.Double | amount | Offset distance. |
Returns
Type | Description |
---|---|
BBox3 |
PointAt(Vector3)
Get a point from this bounding box by supplying a vector specifying normalized parameters from 0 to 1. A point at (0,0,0) will be the minimum point of the bounding box, a point at (1,1,1) will be the maximum point, and a point at (0.5,0.5,0.5) will be the center.
Declaration
public Vector3 PointAt(Vector3 uvw)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | uvw | The vector in the box's parametric UVW coordinate space. |
Returns
Type | Description |
---|---|
Vector3 | A point in world coordinates. |
PointAt(Double, Double, Double)
Get a point from this bounding box by supplying normalized parameters from 0 to 1. A point at (0,0,0) will be the minimum point of the bounding box, a point at (1,1,1) will be the maximum point, and a point at (0.5,0.5,0.5) will be the center.
Declaration
public Vector3 PointAt(double u, double v, double w)
Parameters
Type | Name | Description |
---|---|---|
System.Double | u | The u parameter at which to evaluate the box. |
System.Double | v | The v parameter at which to evaluate the box. |
System.Double | w | The w parameter at which to evaluate the box. |
Returns
Type | Description |
---|---|
Vector3 | A point in world coordinates. |
ToString()
The string representation of the bounding box.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
TransformAt(Double, Double, Double)
Get a transform from this bounding box by supplying normalized parameters from 0 to 1. A point at (0,0,0) will be a transform at the minimum point of the bounding box, a point at (1,1,1) will be at the maximum point, and a point at (0.5,0.5,0.5) will be at the center.
Declaration
public Transform TransformAt(double u, double v, double w)
Parameters
Type | Name | Description |
---|---|---|
System.Double | u | The u parameter at which to evaluate the box. |
System.Double | v | The v parameter at which to evaluate the box. |
System.Double | w | The w parameter at which to evaluate the box. |
Returns
Type | Description |
---|---|
Transform |
Translated(Vector3)
Get a translated copy of the bounding box.
Declaration
public BBox3 Translated(Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | translation | The translation to apply. |
Returns
Type | Description |
---|---|
BBox3 |
UVWAtPoint(Vector3)
For a point in world coordinates, get the corresponding vector in the box's parametric UVW coordinate space.
Declaration
public Vector3 UVWAtPoint(Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | A point in world coordinates. |
Returns
Type | Description |
---|---|
Vector3 | A Vector3 representing the corresponding U,V,W coordinates in the box's coordinate space. |
Operators
Equality(BBox3, BBox3)
Are the two bounding boxes equal within Epsilon?
Declaration
public static bool operator ==(BBox3 a, BBox3 b)
Parameters
Type | Name | Description |
---|---|---|
BBox3 | a | |
BBox3 | b |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(BBox3, BBox3)
Are the two bounding boxes not equal within Epsilon?
Declaration
public static bool operator !=(BBox3 a, BBox3 b)
Parameters
Type | Name | Description |
---|---|---|
BBox3 | a | |
BBox3 | b |
Returns
Type | Description |
---|---|
System.Boolean |