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.
Inherits from:
IEquatable< PlaneBoundary >
Public Fields
holeCount
The number of holes in this boundary.
public int holeCount { get; set; }
polygonVertexCount
The number of vertices in this boundary's polygon.
public int polygonVertexCount { get; set; }
valid
Whether this PlaneBoundary is valid. You should check for validity before invoking GetPolygon(Allocator, NativeArray<Vector2>), GetPolygon(Allocator), GetHole(int, Allocator), or GetHole(int, Allocator, NativeArray<Vector2>).
public bool valid { get; set; }
Public Methods
void CreateOrResizeNativeArrayIfNecessary< T >
public static void CreateOrResizeNativeArrayIfNecessary< T >(
int length,
Allocator allocator,
ref NativeArray< T > array
)
Parameters
Type | Name | Description |
---|---|---|
int | length | |
Allocator | allocator | |
ref NativeArray< T > | array |
override bool Equals
IEquatable interface. Compares for equality.
public override bool Equals(
object obj
)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare for equality. |
Returns: true if obj is of type PlaneBoundary and compares equal with Equals(PlaneBoundary).
bool Equals
IEquatable interface. Compares for equality.
public bool Equals(
PlaneBoundary other
)
Parameters
Type | Name | Description |
---|---|---|
PlaneBoundary | other | The PlaneBoundary to compare against. |
Returns: true if all fields of this PlaneBoundary compare equal to other .
override int GetHashCode
Computes a hash code suitable for use in a Dictionary or HashSet .
public override int GetHashCode()
Returns: A hash code suitable for use in a Dictionary or HashSet .
NativeArray< Vector2 > GetHole
Get the polygon representing a hole in this boundary. The 2D vertices are in plane-space.
public NativeArray< Vector2 > GetHole(
int index,
Allocator allocator
)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the hole. Must be less than holeCount. |
Allocator | allocator | The allocator to use for the returned NativeArray. Must be Allocator.TempJob or Allocator.Persistent . |
Exceptions:
System.InvalidOperationException
Thrown if valid is false.System.InvalidOperationException
Thrown if _allocator_ is Allocator.Temp or Allocator.None .System.ArgumentOutOfRangeException
Thrown if _index_ is less than 0 or greater than or equal to holeCount.
Returns: A new NativeArray allocated with allocator containing a set of 2D vertices in plane-space describing the hole at index .
unsafe void GetHole
Get the polygon representing a hole in this boundary. The 2D vertices are in plane-space.
public unsafe void GetHole(
int index,
Allocator allocator,
ref NativeArray< Vector2 > polygonOut
)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the hole. Must be less than holeCount. |
Allocator | allocator | The allocator to use if _polygonOut_ must be resized. Must be Allocator.TempJob or Allocator.Persistent . |
ref NativeArray< Vector2 > | polygonOut | The resulting polygon describing the hole at _index_ . |
Exceptions:
System.InvalidOperationException
Thrown if valid is false.System.InvalidOperationException
Thrown if _allocator_ is Allocator.Temp or Allocator.None .System.ArgumentOutOfRangeException
Thrown if _index_ is less than 0 or greater than or equal to holeCount.
unsafe void GetPolygon
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.
public unsafe void GetPolygon(
Allocator allocator,
ref NativeArray< Vector2 > polygonOut
)
Parameters
Type | Name | Description |
---|---|---|
Allocator | index | The index of the boundary to retrieve. |
ref NativeArray< Vector2 > | allocator | The Allocator to use if _polygonOut_ must be recreated. Must be Allocator.TempJob or Allocator.Persistent . |
polygonOut | A NativeArray to fill with boundary points. If the array is not the correct size, it is disposed and recreated. |
Exceptions:
System.InvalidOperationException
Thrown if valid is false .System.InvalidOperationException
Thrown if _allocator_ is Allocator.Temp or Allocator.None .
NativeArray< Vector2 > GetPolygon
Gets the polygon representing this boundary. The 2D vertices are in plane-space.
public NativeArray< Vector2 > GetPolygon(
Allocator allocator
)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the returned NativeArray. Must be Allocator.TempJob or Allocator.Persistent . |
Exceptions:
System.InvalidOperationException
Thrown if valid is false .System.InvalidOperationException
Thrown if _allocator_ is Allocator.Temp or Allocator.None .
Returns: 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.
unsafe void TransformMLPolygon
public static unsafe void TransformMLPolygon(
Extensions.MLPolygon mlPolygon,
Pose pose,
Allocator allocator,
ref NativeArray< Vector2 > polygonOut
)
Parameters
Type | Name | Description |
---|---|---|
Extensions.MLPolygon | mlPolygon | |
Pose | pose | |
Allocator | allocator | |
ref NativeArray< Vector2 > | polygonOut |
bool operator!=
Compares for inequality. Same as ! Equals(PlaneBoundary).
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: true if any of the fields of this PlaneBoundary are not equal to other .
bool operator==
Compares for equality. Same as Equals(PlaneBoundary).
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: true if all fields of this PlaneBoundary compare equal to other .
Public Attributes
m_Boundary
public Extensions.MLPlaneBoundary m_Boundary;
m_Pose
public Pose m_Pose;