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 Frame.getUpdatedTrackables(Class)
.
Plane
s are hashable and may for example be used as keys in HashMap
s. 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. |
Public Methods
Anchor
|
createAnchor(Pose pose)
Creates an anchor that is attached to this trackable, using the given initial pose in the world
coordinate space.
|
boolean
|
|
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
Public Methods
public Anchor createAnchor (Pose pose)
createAnchor
public Anchor createAnchor( Pose pose )
Creates an anchor that is attached to this trackable, using the given initial pose in the world coordinate space. 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.
Details | |||
---|---|---|---|
Parameters |
|
public boolean equals (Object obj)
equals
public boolean equals( Object obj )
Indicates whether some other object is a Trackable
referencing the same logical
trackable as this one.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns | true if this object is the same as the obj argument; false otherwise. |
||
See Also |
public Collection<Anchor> getAnchors ()
getAnchors
public Collection<Anchor> getAnchors()
Gets the Anchors attached to this trackable.
public Pose getCenterPose ()
getCenterPose
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 ()
getExtentX
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 ()
getExtentZ
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 ()
getPolygon
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 ()
getSubsumedBy
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.
Details | |
---|---|
Returns | the non-subsumed plane that this one has been merged into, or null if the plane
has not been subsumed.
|
public TrackingState getTrackingState ()
getTrackingState
public TrackingState getTrackingState()
Gets this trackable's TrackingState
.
public Plane.Type getType ()
getType
public Plane.Type getType()
Returns the type of this plane.
public int hashCode ()
hashCode
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
.
Details | |
---|---|
Returns | a hash code value for this object. |
See Also |
public boolean isPoseInExtents (Pose pose)
isPoseInExtents
public boolean isPoseInExtents( Pose pose )
Returns true if the given pose (usually obtained from a HitResult) is in the plane's rectangular extents.
Details | |||
---|---|---|---|
Parameters |
|
public boolean isPoseInPolygon (Pose pose)
isPoseInPolygon
public boolean isPoseInPolygon( Pose pose )
Returns true if the given pose (usually obtained from a HitResult) is in the plane's polygon.
Details | |||
---|---|---|---|
Parameters |
|