Struct DoubleBounds
Represents an axis aligned bounding box with values stored as doubles.
Namespace: Unity.Geospatial.HighPrecision
Assembly: solution.dll
Syntax
[BurstCompile(CompileSynchronously = true)]
[Serializable]
public readonly struct DoubleBounds : IEquatable<DoubleBounds>, IFormattable
Constructors
DoubleBounds(double3, double3)
Default constructor.
Declaration
public DoubleBounds(double3 center, double3 size)
Parameters
Type | Name | Description |
---|---|---|
double3 | center | The location of the origin of the Bounds. |
double3 | size | The dimensions of the Bounds. |
Fields
Center
The center of the bounding box.
Declaration
public readonly double3 Center
Field Value
Type | Description |
---|---|
double3 |
Extents
Distance between the center and the edges of the bounds.
Declaration
public readonly double3 Extents
Field Value
Type | Description |
---|---|
double3 |
Properties
Empty
Get a DoubleBounds instance that is considered empty (no position, no size).
Declaration
public static readonly DoubleBounds Empty { get; }
Property Value
Type | Description |
---|---|
DoubleBounds |
IsEmpty
Declaration
public readonly bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Max
The maximal point of the box. This is always equal to center+extents.
Declaration
public readonly double3 Max { get; }
Property Value
Type | Description |
---|---|
double3 |
Min
The minimal point of the box. This is always equal to center-extents.
Declaration
public readonly double3 Min { get; }
Property Value
Type | Description |
---|---|
double3 |
Size
The total size of the box. This is always twice as large as the extents.
Declaration
public readonly double3 Size { get; }
Property Value
Type | Description |
---|---|
double3 |
Methods
Contains(DoubleBounds)
Is the given bounds
limits are within the limits of this instance.
Declaration
public readonly bool Contains(DoubleBounds bounds)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | bounds | The DoubleBounds that must be within this instance. |
Returns
Type | Description |
---|---|
Boolean | true if the |
Equals(Object)
Validate obj
is a DoubleBounds instance and have the same values as this instance.
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | Compare the values with this instance. |
Returns
Type | Description |
---|---|
Boolean | true if both instance have the same values; false otherwise. |
Overrides
Equals(DoubleBounds)
Validate an other DoubleBounds has the same values as this instance.
Declaration
public readonly bool Equals(DoubleBounds other)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | other | Compare the values with this instance. |
Returns
Type | Description |
---|---|
Boolean | true if both instances have the same values; false otherwise. |
GetHashCode()
Compute a hash code for the object.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for the current object. |
Overrides
Remarks
- You should not assume that equal hash codes imply object equality.
- You should never persist or use a hash code outside the application domain in which it was created, because the same object may hash differently across application domains, processes, and platforms.
Intersects(DoubleBounds)
Does another bounding box intersect with an other bounding box? Check if the bounding box comes into contact with another bounding box. This returns a Boolean that is set to true if there is an intersection between bounds. Two bounds are intersecting if there is at least one point which is contained by both bounds. Points on the min and max limits (corners and edges) of the bounding box are considered inside.
Declaration
public readonly bool Intersects(DoubleBounds bounds)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | bounds | The other DoubleBounds to validate the intersection with. |
Returns
Type | Description |
---|---|
Boolean | true If the |
ToString()
Returns a formatted string for the bounds.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String | The formatted string representing this instance. |
Overrides
ToString(String)
Returns a formatted string for the bounds.
Declaration
public readonly string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
String | format | A numeric format string. |
Returns
Type | Description |
---|---|
String | The formatted string representing this instance. |
ToString(String, IFormatProvider)
Returns a formatted string for the bounds.
Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
String | format | A numeric format string. |
IFormatProvider | formatProvider | An object that specifies culture-specific formatting. |
Returns
Type | Description |
---|---|
String | The formatted string representing this instance. |
Transform(DoubleBounds, double4x4, DoublePlane)
Apply a DoublePlane to the original DoubleBounds then
translate / rotate / scale it according to the given transformMatrix
.
Declaration
public static DoubleBounds Transform(DoubleBounds bounds, double4x4 transformMatrix, DoublePlane clipPlane)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | bounds | Instance to transform. |
double4x4 | transformMatrix | Translate / Rotate / Resize the bounds by this matrix. |
DoublePlane | clipPlane | Cut the resulting DoubleBounds by this plane. |
Returns
Type | Description |
---|---|
DoubleBounds | The result of the transformation. |
Transform3x4(DoubleBounds, double4x4)
Transform a DoubleBounds instance by a matrix allowing to translate / turn / scale it.
Declaration
public static DoubleBounds Transform3x4(DoubleBounds bounds, double4x4 transformationMatrix)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | bounds | Instance to transform. |
double4x4 | transformationMatrix | Translate / Rotate / Resize the bounds by this matrix. |
Returns
Type | Description |
---|---|
DoubleBounds | The result of the transformation. |
Union(DoubleBounds, DoubleBounds)
Join two DoubleBounds instance into a single instance resulting in the maximum size of both.
Declaration
public static DoubleBounds Union(DoubleBounds a, DoubleBounds b)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | a | |
DoubleBounds | b |
Returns
Type | Description |
---|---|
DoubleBounds |
Operators
Equality(DoubleBounds, DoubleBounds)
Validate both DoubleBounds have the same values.
Declaration
public static bool operator ==(DoubleBounds lhs, DoubleBounds rhs)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | lhs | First instance to compare with. |
DoubleBounds | rhs | Compare |
Returns
Type | Description |
---|---|
Boolean | true if both instance have the same values; false otherwise. |
Explicit(DoubleBounds to Bounds)
Convert a DoubleBounds instance to a new single precision Unity Bounds instance.
Declaration
public static explicit operator Bounds(DoubleBounds bounds)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | bounds | The instance to convert. |
Returns
Type | Description |
---|---|
Bounds | A new Bounds instance. |
Explicit(Bounds to DoubleBounds)
Convert a single precision Unity Bounds instance to a new DoubleBounds instance.
Declaration
public static explicit operator DoubleBounds(Bounds bounds)
Parameters
Type | Name | Description |
---|---|---|
Bounds | bounds | The instance to convert. |
Returns
Type | Description |
---|---|
DoubleBounds | A new DoubleBounds instance. |
Inequality(DoubleBounds, DoubleBounds)
Validate both DoubleBounds have the different values.
Declaration
public static bool operator !=(DoubleBounds lhs, DoubleBounds rhs)
Parameters
Type | Name | Description |
---|---|---|
DoubleBounds | lhs | First instance to compare with. |
DoubleBounds | rhs | Compare |
Returns
Type | Description |
---|---|
Boolean | true if at least one value is different on both instances; false if both instance have the same values. |