AR + GPS Location  3.0.0
All Classes Namespaces Functions Variables Properties Events Pages
ARLocation.Location Class Reference

Represents a geographical location. More...

Public Member Functions

 Location (double latitude=0.0, double longitude=0.0, double altitude=0.0)
 
Location Clone ()
 Clones this instance. More...
 
override string ToString ()
 
DVector3 ToDVector3 ()
 
Vector3 ToVector3 ()
 

Static Public Member Functions

static DVector3 LocationToEcef (Location l)
 Given a Location returns the corresponding (x, y, z) ECEF coordinates. More...
 
static DVector2 VectorFromToEcefEnu (Location l1, Location l2)
 Given a pair of locations, returns the local-plane ENU coordinates, considering the first location, l1, to be the center of the local plane. More...
 
static Location LocationFromEnu (Location center, double e, double n, double u)
 Given a center location, and the local-plane ENU coordinates of a second point, calculates the Location of the second point. More...
 
static Location EcefToLocation (DVector3 ecef)
 Converts from (x, y, z) ECEF coordinates to a wgs84 Location. More...
 
static double HorizontalDistance (Location l1, Location l2)
 Calculates the horizontal distance according to the current function set in the configuration. More...
 
static double DistanceWithAltitude (Location l1, Location l2)
 Calculates the full distance between locations, taking altitude into account. More...
 
static DVector2 HorizontalVectorFromTo (Location l1, Location l2)
 Calculates the horizontal vector pointing from l1 to l2, in meters. More...
 
static DVector3 VectorFromTo (Location l1, Location l2, bool ignoreHeight=false)
 Calculates the vector from l1 to l2, in meters, taking altitude into account. More...
 
static Vector3 GetGameObjectPositionForLocation (Transform arLocationRoot, Vector3 userPosition, Location userLocation, Location objectLocation, bool heightIsRelative)
 Gets the game object world-position for location. More...
 
static Vector3 GetGameObjectPositionForLocation (Transform arLocationRoot, Transform user, Location userLocation, Location objectLocation, bool heightIsRelative)
 Gets the game object world-position for location. More...
 
static void PlaceGameObjectAtLocation (Transform arLocationRoot, Transform transform, Transform user, Location userLocation, Location objectLocation, bool heightIsRelative)
 Places the game object at location. More...
 
static Location GetLocationForWorldPosition (Transform arLocationRoot, Vector3 center, Location userLocation, Vector3 worldPosition)
 Calculates the wgs84 Location for a given world position vector. More...
 
static bool Equal (Location a, Location b, double eps=0.0000001)
 
static double RadToDeg (double rad)
 
static double DegToRad (double deg)
 

Public Attributes

double Latitude
 
double Longitude
 
double Altitude
 
AltitudeMode AltitudeMode = AltitudeMode.GroundRelative
 
string Label = ""
 
bool IgnoreAltitude => AltitudeMode == AltitudeMode.Ignore
 
DVector2 HorizontalVector => new DVector2(Latitude, Longitude)
 Gets the horizontal vector. More...
 

Detailed Description

Represents a geographical location.

Definition at line 18 of file Location.cs.

Member Function Documentation

◆ Clone()

Location ARLocation.Location.Clone ( )

Clones this instance.

Returns
The clone.

Definition at line 59 of file Location.cs.

◆ DistanceWithAltitude()

static double ARLocation.Location.DistanceWithAltitude ( Location  l1,
Location  l2 
)
static

Calculates the full distance between locations, taking altitude into account.

Returns
The with altitude.
Parameters
l1L1.
l2L2.

Definition at line 229 of file Location.cs.

◆ EcefToLocation()

static Location ARLocation.Location.EcefToLocation ( DVector3  ecef)
static

Converts from (x, y, z) ECEF coordinates to a wgs84 Location.

Parameters
ecef
Returns

Definition at line 168 of file Location.cs.

◆ GetGameObjectPositionForLocation() [1/2]

static Vector3 ARLocation.Location.GetGameObjectPositionForLocation ( Transform  arLocationRoot,
Transform  user,
Location  userLocation,
Location  objectLocation,
bool  heightIsRelative 
)
static

Gets the game object world-position for location.

Returns
The game object position for location.
Parameters
arLocationRoot
userUser.
userLocationUser location.
objectLocationObject location.
heightIsRelativeIf set to true height is relative.

Definition at line 296 of file Location.cs.

◆ GetGameObjectPositionForLocation() [2/2]

static Vector3 ARLocation.Location.GetGameObjectPositionForLocation ( Transform  arLocationRoot,
Vector3  userPosition,
Location  userLocation,
Location  objectLocation,
bool  heightIsRelative 
)
static

Gets the game object world-position for location.

Parameters
arLocationRoot
userPosition
userLocation
objectLocation
heightIsRelative
Returns

Definition at line 276 of file Location.cs.

◆ GetLocationForWorldPosition()

static Location ARLocation.Location.GetLocationForWorldPosition ( Transform  arLocationRoot,
Vector3  center,
Location  userLocation,
Vector3  worldPosition 
)
static

Calculates the wgs84 Location for a given world position vector.

Parameters
arLocationRootThe ARLocationRoot game object transform.
centerThe position of the center (i.e., the device).
userLocationThe wgs84 Location of the center/device.
worldPositionThe world position.
Returns

Definition at line 324 of file Location.cs.

◆ HorizontalDistance()

static double ARLocation.Location.HorizontalDistance ( Location  l1,
Location  l2 
)
static

Calculates the horizontal distance according to the current function set in the configuration.

Returns
The distance, in meters.
Parameters
l1L1.
l2L2.

Definition at line 214 of file Location.cs.

◆ HorizontalVectorFromTo()

static DVector2 ARLocation.Location.HorizontalVectorFromTo ( Location  l1,
Location  l2 
)
static

Calculates the horizontal vector pointing from l1 to l2, in meters.

Returns
The vector from to.
Parameters
l1L1.
l2L2.

Definition at line 243 of file Location.cs.

◆ LocationFromEnu()

static Location ARLocation.Location.LocationFromEnu ( Location  center,
double  e,
double  n,
double  u 
)
static

Given a center location, and the local-plane ENU coordinates of a second point, calculates the Location of the second point.

Parameters
center
e
n
u
Returns

Definition at line 140 of file Location.cs.

◆ LocationToEcef()

static DVector3 ARLocation.Location.LocationToEcef ( Location  l)
static

Given a Location returns the corresponding (x, y, z) ECEF coordinates.

Parameters
l
Returns

Definition at line 91 of file Location.cs.

◆ PlaceGameObjectAtLocation()

static void ARLocation.Location.PlaceGameObjectAtLocation ( Transform  arLocationRoot,
Transform  transform,
Transform  user,
Location  userLocation,
Location  objectLocation,
bool  heightIsRelative 
)
static

Places the game object at location.

Parameters
arLocationRoot
transformThe GameObject's transform.
userThe user's point of view Transform, e.g., camera.
userLocationUser Location.
objectLocationObject Location.
heightIsRelative

Definition at line 311 of file Location.cs.

◆ VectorFromTo()

static DVector3 ARLocation.Location.VectorFromTo ( Location  l1,
Location  l2,
bool  ignoreHeight = false 
)
static

Calculates the vector from l1 to l2, in meters, taking altitude into account.

Returns
The from to.
Parameters
l1L1.
l2L2.
ignoreHeightIf true, y = 0 in the output vector.

Definition at line 259 of file Location.cs.

◆ VectorFromToEcefEnu()

static DVector2 ARLocation.Location.VectorFromToEcefEnu ( Location  l1,
Location  l2 
)
static

Given a pair of locations, returns the local-plane ENU coordinates, considering the first location, l1, to be the center of the local plane.

Parameters
l1
l2
Returns

Definition at line 113 of file Location.cs.

Member Data Documentation

◆ HorizontalVector

DVector2 ARLocation.Location.HorizontalVector => new DVector2(Latitude, Longitude)

Gets the horizontal vector.

The horizontal vector.

Definition at line 46 of file Location.cs.


The documentation for this class was generated from the following file: