Struct PlaneBoundary
Container for the boundary of a detected planar surface. This is specific to Magic Leap because the polygon describing the boundary may be concave, and may contain holes.
Namespace: UnityEngine.XR.MagicLeap
Syntax
public struct PlaneBoundary : IEquatable<PlaneBoundary>
Properties
holeCount
The number of holes in this boundary.
Declaration
public readonly int holeCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
polygonVertexCount
The number of vertices in this boundary's polygon.
Declaration
public int polygonVertexCount { get; }
Property Value
Type | Description |
---|---|
Int32 |
valid
Whether this PlaneBoundary is valid. You should check
for validity before invoking
Declaration
public readonly bool valid { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Equals(Object)
IEquatable interface. Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare for equality. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Equals(PlaneBoundary)
IEquatable interface. Compares for equality.
Declaration
public bool Equals(PlaneBoundary other)
Parameters
Type | Name | Description |
---|---|---|
PlaneBoundary | other | The PlaneBoundary to compare against. |
Returns
Type | Description |
---|---|
Boolean |
|
GetHashCode()
Computes a hash code suitable for use in a Dictionary
or HashSet
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code suitable for use in a |
Overrides
GetHole(Int32, Allocator)
Get the polygon representing a hole in this boundary. The 2D vertices are in plane-space.
Declaration
public NativeArray<Vector2> GetHole(int index, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the hole. Must be less than holeCount. |
Allocator | allocator | The allocator to use for the returned NativeArray.
Must be |
Returns
Type | Description |
---|---|
NativeArray<Vector2> | A new NativeArray allocated with |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if valid is false. |
InvalidOperationException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
GetHole(Int32, Allocator, ref NativeArray<Vector2>)
Get the polygon representing a hole in this boundary. The 2D vertices are in plane-space.
Declaration
public void GetHole(int index, Allocator allocator, ref NativeArray<Vector2> polygonOut)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the hole. Must be less than holeCount. |
Allocator | allocator | The allocator to use if |
NativeArray<Vector2> | polygonOut | The resulting polygon describing the hole at |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if valid is false. |
InvalidOperationException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
GetPolygon(Allocator)
Gets the polygon representing this boundary. The 2D vertices are in plane-space.
Declaration
public NativeArray<Vector2> GetPolygon(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the returned NativeArray. Must be |
Returns
Type | Description |
---|---|
NativeArray<Vector2> | A new NativeArray containing a set of 2D points in plane-space representing a boundary for a plane. The caller is responsible for disposing the NativeArray. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if valid is |
InvalidOperationException | Thrown if |
GetPolygon(Allocator, ref NativeArray<Vector2>)
Gets the polygon representing a plane's boundary, and, if successful, copies it to polygonOut
.
polygonOut
is resized or created using if necessary.
The 2D vertices are in plane-space.
Declaration
public void GetPolygon(Allocator allocator, ref NativeArray<Vector2> polygonOut)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The Allocator to use if |
NativeArray<Vector2> | polygonOut | A NativeArray to fill with boundary points. If the array is not the correct size, it is disposed and recreated. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if valid is |
InvalidOperationException | Thrown if |
Operators
Equality(PlaneBoundary, PlaneBoundary)
Compares for equality. Same as Equals(PlaneBoundary).
Declaration
public static bool operator ==(PlaneBoundary lhs, PlaneBoundary rhs)
Parameters
Type | Name | Description |
---|---|---|
PlaneBoundary | lhs | The left-hand side of the comparison. |
PlaneBoundary | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(PlaneBoundary, PlaneBoundary)
Compares for inequality. Same as !
Equals(PlaneBoundary).
Declaration
public static bool operator !=(PlaneBoundary lhs, PlaneBoundary rhs)
Parameters
Type | Name | Description |
---|---|---|
PlaneBoundary | lhs | The left-hand side of the comparison. |
PlaneBoundary | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|