Wikitude SDK API Reference

API Docs for: 8.2.0
Show:

RelativeLocation Class

Extends Location
Module: AR

A relative location describes a location that is relative to either another Location, or the location of the user.

It is specified using the northing and easting of the location in relation to the referenced location. An optional altitudeDelta can also be applied.

Example:
//a relative location being 12 meters south, 20 meters west and 13 meters lower than current position of the user
var location2 = new AR.RelativeLocation(null, -12, -20, -13);

var geoLoc = new AR.GeoLocation(47.77317, 13.069929, 320.);
//a relative location being 12 meters north, 20 meters east and 13 meters higher than geoLoc
var location1 = new AR.RelativeLocation(geoLoc, 12, 20, 13);

Relative locations move with their referenced locations.

Constructor

RelativeLocation

(
  • location
  • northing
  • easting
  • altitudeDelta
)

Parameters:

  • location Location

    The location which is used as the reference point. If null is passed, the current position of the user is used as a reference point.

  • northing Number

    Specifies the number of meters the relative location is further north than the referenced location. A negative value specifies the number of meters south.

  • easting Number

    Specifies the number of meters the relative location is further east than the referenced location. A negative value specifies the number of meters west.

  • altitudeDelta (defaults to 0) Number optional

    Specifies the number of meters the relative location is higher (positive) or lower (negative) than the referenced location. This is also applied when the altitude of the referenced location is unknown, causing the relative location to definitely appear higher or lower then the referenced location.

Methods

destroy

()

Inherited from ARchitectObject

Destroys the object.

distanceTo

(
  • location
)
Number

Inherited from Location

Returns the shortest distance ("as the crow flies") to the Location passed as an argument, ignoring any altitude property.

Example:
var location1 = new AR.GeoLocation(47.77317, 13.069929);
var location2 = new AR.GeoLocation(47.77317, 13.069929, 320.);
var location3 = new AR.GeoLocation(47.77317, 14.069929, 640.);
var dist = location2.distanceTo(location1); //dist = 0.
dist = location2.distanceTo(location3); //dist = 74730.

Parameters:

  • location Location

    The Location the distance should be calculated for.

Returns:

Number:

The numeric distance in meters.

distanceToUser

() Number

Inherited from Location

Returns the shortest distance ("as the crow flies") to the current location of the user, ignoring any altitude property.

If the current position of the user cannot be determined, undefined will be returned.

Returns:

Number:

The numeric distance in meters.

Properties

altitudeDelta

Number

Specifies the number of meters the relative location is higher (positive) or lower (negative) than the referenced location. This is also applied when the altitude of the referenced location is unknown, causing the relative location to definitely appear higher or lower then the referenced location. If the property is set to null, 0 will be applied as the altitudeDelta.

destroyed

Boolean

Inherited from ARchitectObject

Indicates if the object has already been destroyed.

easting

Number

Specifies the number of meters the relative location is further east than the referenced location. A negative value specifies the number of meters west.

location

Location

The location which is used as the reference point. If null is passed, the current position of the user is used as a reference point.

northing

Number

Specifies the number of meters the relative location is further north than the referenced location. A negative value specifies the number of meters south.