GuavaEarth

Added in 1.0.0-alpha05

public final class GuavaEarth


Summary

Public methods

static final @NonNull ListenableFuture<@NonNull AnchorCreateResult>
createAnchorOnSurfaceAsync(
    @NonNull Earth receiver,
    @NonNull Session session,
    double latitude,
    double longitude,
    double altitudeAboveSurface,
    @NonNull Quaternion eastUpSouthQuaternion,
    @NonNull Earth.Surface surface
)

Asynchronously creates a new Anchor at a specified horizontal position and altitude relative to the horizontal position's surface (Terrain or Rooftop).

Public methods

createAnchorOnSurfaceAsync

public static final @NonNull ListenableFuture<@NonNull AnchorCreateResultcreateAnchorOnSurfaceAsync(
    @NonNull Earth receiver,
    @NonNull Session session,
    double latitude,
    double longitude,
    double altitudeAboveSurface,
    @NonNull Quaternion eastUpSouthQuaternion,
    @NonNull Earth.Surface surface
)

Asynchronously creates a new Anchor at a specified horizontal position and altitude relative to the horizontal position's surface (Terrain or Rooftop).

The specified altitudeAboveSurface is interpreted to be relative to the given surface at the specified latitude/longitude geospatial coordinates, rather than relative to the WGS84 ellipsoid. Specifying an altitude of 0 will position the anchor directly on the surface whereas specifying a positive altitude will position the anchor above the surface, against the direction of gravity.

Surface.TERRAIN refers to the Earth's terrain (or floor) and Surface.ROOFTOP refers to the top of a building at the given horizontal location. If there is no building at the given location, then the rooftop surface is interpreted to be the terrain instead.

You may resolve multiple anchors at a time, but a session cannot be tracking more than 100 surface anchors at time. Attempting to resolve more than 100 surface anchors will return an AnchorCreateResourcesExhausted result.

Creating a Terrain anchor requires an active Earth which is State.RUNNING. If it is not, then this function returns an AnchorCreateIllegalState result. This call also requires a working internet connection to communicate with the ARCore API on Google Cloud. ARCore will continue to retry if it is unable to establish a connection to the ARCore service.

A Terrain anchor's tracking state will be TrackingState.PAUSED if the Earth is not actively tracking. Its tracking state will permanently become TrackingState.STOPPED if Config.GeospatialMode is disabled, or if another full-space app uses Geospatial.

Latitude and longitude are defined by the WGS84 specification, and the altitude value is defined by the elevation above the Earth's terrain (or floor) in meters.

The rotation quaternion provided is with respect to an east-up-south coordinate frame. An identity rotation will have the anchor oriented such that X+ points to the east, Y+ points up away from the center of the earth, and Z+ points to the south.

Parameters
@NonNull Session session

the current Session.

double latitude

the latitude of the anchor.

double longitude

the longitude of the anchor.

double altitudeAboveSurface

The altitude of the anchor above the given surface.

@NonNull Quaternion eastUpSouthQuaternion

the rotation Quaternion of the anchor.

@NonNull Earth.Surface surface

the Surface the anchor is attached to.

Throws
kotlin.IllegalArgumentException

if the latitude is outside the allowable range.