RelativeLocation Class
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.
//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
LocationThe 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
NumberSpecifies the number of meters the relative location is further north than the referenced location. A negative value specifies the number of meters south.
-
easting
NumberSpecifies 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 to0
) Number optionalSpecifies 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.
Item Index
Methods
Properties
Methods
destroy
()
Destroys the object.
distanceTo
-
location
Returns the shortest distance ("as the crow flies")
to the Location passed as an argument, ignoring any altitude property.
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
LocationThe Location the distance should be calculated for.
Returns:
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.
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.