Skip to main content
Version: 21 Aug 2024

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

TypeNameDescription
intlength
Allocatorallocator
ref NativeArray< T >array

override bool Equals

IEquatable interface. Compares for equality.

public override bool Equals(
object obj
)

Parameters

TypeNameDescription
objectobjThe 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

TypeNameDescription
PlaneBoundaryotherThe 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

TypeNameDescription
intindexThe index of the hole. Must be less than holeCount.
AllocatorallocatorThe 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

TypeNameDescription
intindexThe index of the hole. Must be less than holeCount.
AllocatorallocatorThe allocator to use if _polygonOut_ must be resized. Must be Allocator.TempJob or Allocator.Persistent .
ref NativeArray< Vector2 >polygonOutThe 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

TypeNameDescription
AllocatorindexThe index of the boundary to retrieve.
ref NativeArray< Vector2 >allocatorThe Allocator to use if _polygonOut_ must be recreated. Must be Allocator.TempJob or Allocator.Persistent .
polygonOutA 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

TypeNameDescription
AllocatorallocatorThe 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

TypeNameDescription
Extensions.MLPolygonmlPolygon
Posepose
Allocatorallocator
ref NativeArray< Vector2 >polygonOut

bool operator!=

Compares for inequality. Same as ! Equals(PlaneBoundary).

public static bool operator!=(
PlaneBoundary lhs,
PlaneBoundary rhs
)

Parameters

TypeNameDescription
PlaneBoundarylhsThe left-hand side of the comparison.
PlaneBoundaryrhsThe 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

TypeNameDescription
PlaneBoundarylhsThe left-hand side of the comparison.
PlaneBoundaryrhsThe 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;