We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesAR EngineAndroidAR Engine APIsJava APIcom.huawei.hiarClass SummaryARHitResult

ARHitResult

Expand

Class Info

public class ARHitResult

Defines the hit point between the ray (such as a ray starting from a point on the screen) and the real world (such as a point cloud or plane).

Public Method Summary

Expand

Qualifier and Type

Method Name and Description

ARAnchor

createAnchor()

Creates a new anchor at the intersection.

float

getDistance()

Returns the distance between the camera and intersection, in meters.

ARPose

getHitPose()

Obtains the pose of an intersection, whose translation vector corresponds to the coordinates of the intersection in a world coordinate system. The rotation degrees vary according to different types of intersection points (such as with a plane or a point cloud).

  1. When a ray collides with the plane, in the local coordinate system: X+ is perpendicular to the ray and parallel to the tracking plane. Y+ is the normal vector of the tracking plane. Z+ is parallel to the plane and roughly points to the camera.
  2. When a ray collides with a point in a point cloud, the system attempts to estimate a plane by using the point cloud of the clicked area. If getOrientationMode() returns ESTIMATED_SURFACE_NORMAL, X+ is perpendicular to the ray and parallel to the tracking plane, Y+ is the normal vector of the tracking plane. Z+ is parallel to the plane and roughly points to the camera. If INITIALIZED_TO_IDENTITY is returned, the coordinate orientation does not change with the plane's angle. X+ is perpendicular to the ray and points to the right (from the perspective of the device). Y+ points upwards, and Z+ points to the camera. For details, see orientation modes.

ARTrackable

getTrackable()

Returns the trackable object that was hit.

Public Methods

createAnchor

Expand

Method

public ARAnchor createAnchor()

Creates an anchor at the intersection.

Throws

Expand

Name

Description

ARFatalException

When a fatal exception occurs, such as when the session is not created or is released before this method is called.

ARResourceExhaustedException

When anchor creation failed due to insufficient resources.

Returns

Expand

Type

Description

ARAnchor

Returns the information about the new anchor.

getDistance

Expand

Method

public float getDistance()

Returns the distance between the camera and intersection, in meters.

Returns

Expand

Type

Description

float

Returns the distance between the camera and intersection.

getHitPose

Expand

Method

public ARPose getHitPose()

Obtains the pose of an intersection, whose translation vector corresponds to the coordinates of the intersection in a world coordinate system. The rotation degrees vary according to different types of intersection points (such as with a plane or a point cloud).

  1. When a ray collides with the plane, in the local coordinate system: X+ is perpendicular to the ray and parallel to the tracking plane. Y+ is the normal vector of the tracking plane. Z+ is parallel to the plane and roughly points to the camera.
  2. When a ray collides with a point in a point cloud, the system attempts to estimate a plane by using the point cloud of the clicked area. If getOrientationMode() returns ESTIMATED_SURFACE_NORMAL, X+ is perpendicular to the ray and parallel to the tracking plane, Y+ is the normal vector of the tracking plane. Z+ is parallel to the plane and roughly points to the camera. If INITIALIZED_TO_IDENTITY is returned, the coordinate orientation does not change with the plane's angle. X+ is perpendicular to the ray and points to the right (from the perspective of the device). Y+ points upwards, and Z+ points to the camera. For details, see orientation modes.

Returns

Expand

Type

Description

ARPose

Returns the pose of the intersection.

getTrackable

Expand

Method

public ARTrackable getTrackable()

Returns the trackable object that was hit.

Returns

Expand

Type

Description

ARTrackable

Returns the trackable object that was hit.

Search in References
Enter a keyword.