Struct PlaneBoundary | Magic Leap XR Plugin | 6.0.0
docs.unity3d.com
    Show / Hide Table of Contents

    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 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 , GetPolygon(Allocator), GetHole(Int32, Allocator), or .

    Declaration
    public 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

    true if obj is of type PlaneBoundary and compares equal with Equals(PlaneBoundary).

    Overrides
    ValueType.Equals(Object)

    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

    true if all fields of this PlaneBoundary compare equal to other.

    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 Dictionary or HashSet.

    Overrides
    ValueType.GetHashCode()

    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 Allocator.TempJob or Allocator.Persistent.

    Returns
    Type Description
    NativeArray<Vector2>

    A new NativeArray allocated with allocator containing a set of 2D vertices in plane-space describing the hole at index.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if valid is false.

    InvalidOperationException

    Thrown if allocator is Allocator.Temp or Allocator.None.

    ArgumentOutOfRangeException

    Thrown if index is less than 0 or greater than or equal to holeCount.

    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 polygonOut must be resized. Must be Allocator.TempJob or Allocator.Persistent.

    NativeArray<Vector2> polygonOut

    The resulting polygon describing the hole at index.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if valid is false.

    InvalidOperationException

    Thrown if allocator is Allocator.Temp or Allocator.None.

    ArgumentOutOfRangeException

    Thrown if index is less than 0 or greater than or equal to holeCount.

    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 Allocator.TempJob or Allocator.Persistent.

    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 false.

    InvalidOperationException

    Thrown if allocator is Allocator.Temp or Allocator.None.

    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 polygonOut must be recreated. Must be Allocator.TempJob or Allocator.Persistent.

    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 false.

    InvalidOperationException

    Thrown if allocator is Allocator.Temp or Allocator.None.

    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

    true if all fields of this PlaneBoundary compare equal to other.

    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

    true if any of the fields of this PlaneBoundary are not equal to other.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023