Plane

public class Plane

Describes the current best knowledge of a real-world planar surface.

Merging / Subsumption

Two or more planes may be automatically merged into a single parent plane, resulting in each child plane's getSubsumedBy() returning the parent plane. A subsumed plane becomes identical to the parent plane, and will continue behaving as if it were independently tracked, for example being included in the output of getUpdatedTrackables(Class).

Planes are hashable and may for example be used as keys in HashMaps. Subsumed planes are distinct from their parents and siblings.

Change from Developer Preview 1: Two Plane objects may refer to the same logical plane detected by the system. Be sure to always use equals(Object) when comparing them.

Nested Classes

enum Plane.Type Simple summary of the normal vector of a plane, for filtering purposes. 

Protected Constructors

Plane()
(FOR TESTING) Constructs a new instance for use as a mock.

Public Methods

Anchor
createAnchor(Pose pose)
Creates an Anchor at the given Pose in the world coordinate space that is attached to this Trackable.
boolean
equals(Object obj)
Indicates whether some other object is a Trackable referencing the same logical trackable as this one.
Collection<Anchor>
getAnchors()
Gets the Anchors attached to this Trackable.
Pose
getCenterPose()
Returns the pose of the center of the detected plane.
float
getExtentX()
Returns the length of this plane's bounding rectangle measured along the local X-axis of the coordinate space centered on the plane.
float
getExtentZ()
Returns the length of this plane's bounding rectangle measured along the local Z-axis of the coordinate frame centered on the plane.
FloatBuffer
getPolygon()
Returns the 2D vertices of a convex polygon approximating the detected plane, in the form [x1, z1, x2, z2, ...].
Plane
getSubsumedBy()
If this plane has been subsumed, returns the plane this plane was merged into.
TrackingState
getTrackingState()
Gets this trackable's TrackingState.
Plane.Type
getType()
Returns the type of this plane.
int
hashCode()
Returns a hash code value for the object.
boolean
isPoseInExtents(Pose pose)
Returns true if the given pose (usually obtained from a HitResult) is in the plane's rectangular extents.
boolean
isPoseInPolygon(Pose pose)
Returns true if the given pose (usually obtained from a HitResult) is in the plane's polygon.

Inherited Methods

Protected Constructors

protected Plane ()

(FOR TESTING) Constructs a new instance for use as a mock. Calling any base method implementation on this instance (including even equals(Object) and hashCode()) may return unexpected results, throw an exception, or even crash.

To obtain a Plane normally, see getUpdatedTrackables(Class), getAllTrackables(Class), or getTrackable().

Public Methods

public Anchor createAnchor (Pose pose)

Creates an Anchor at the given Pose in the world coordinate space that is attached to this Trackable. The type of Trackable will determine the semantics of attachment and how the Anchor's Pose will be updated to maintain this relationship. Note that the relative offset between the Pose of multiple Anchors attached to a Trackable may adjust slightly over time as ARCore updates its model of the world.

Parameters
pose

public boolean equals (Object obj)

Indicates whether some other object is a Trackable referencing the same logical trackable as this one.

Parameters
obj the reference object with which to compare.
Returns
  • true if this object is the same as the obj argument; false otherwise.

public Collection<Anchor> getAnchors ()

Gets the Anchors attached to this Trackable.

public Pose getCenterPose ()

Returns the pose of the center of the detected plane. The pose's transformed +Y axis will be point normal out of the plane, with the +X and +Z axes orienting the extents of the bounding rectangle.

public float getExtentX ()

Returns the length of this plane's bounding rectangle measured along the local X-axis of the coordinate space centered on the plane.

public float getExtentZ ()

Returns the length of this plane's bounding rectangle measured along the local Z-axis of the coordinate frame centered on the plane.

public FloatBuffer getPolygon ()

Returns the 2D vertices of a convex polygon approximating the detected plane, in the form [x1, z1, x2, z2, ...]. These X-Z values are in the plane's local x-z plane (y=0) and must be transformed by the pose (getCenterPose()) to get the boundary in world coordinates.

public Plane getSubsumedBy ()

If this plane has been subsumed, returns the plane this plane was merged into. In cases where a subsuming plane is itself subsumed, this function will always return the topmost non-subsumed plane.

See the Merging / Subsumption section above for details of the subsumption process.

Returns
  • the non-subsumed plane that this one has been merged into, or null if the plane has not been subsumed.

public TrackingState getTrackingState ()

Gets this trackable's TrackingState.

public Plane.Type getType ()

Returns the type of this plane.

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

Returns
  • a hash code value for this object.
See Also

public boolean isPoseInExtents (Pose pose)

Returns true if the given pose (usually obtained from a HitResult) is in the plane's rectangular extents.

Parameters
pose

public boolean isPoseInPolygon (Pose pose)

Returns true if the given pose (usually obtained from a HitResult) is in the plane's polygon.

Parameters
pose

Send feedback about...