![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The geo location class.
Get the rotation matrix from acceleration and geomagnetic values.
Murl.Math.Matrix GetRotationMatrix(Murl.Math.Vector acceleration, Murl.Math.Vector geomagnetic)
acceleration | The acceleration vector. |
geomagnetic | The geomagnetic field vector. |
Get the geo rotation angles from a rotation matrix. Extracts the following rotation angles:
Murl.Math.Vector GetRotationAngles(Murl.Math.Matrix rotation)
rotation | The rotation matrix, typically from GetRotationMatrix(). |
The default constructor.
Murl.Util.GeoLocation new()
The constructor taking separate location values.
Murl.Util.GeoLocation new(Number latitude, Number longitude, Number altitude)
latitude | The latitude in degrees relative to the equator. |
longitude | The longitude in degrees relative to the zero meridian. |
altitude | The altitude above sea level in meters. |
Check if the location is zero.
Boolean IsZero()
Calculate the distance from this location to a geo location. The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes. The altitude is not considered.
The calculation uses the simple spherical law of cosines formula.
distance = acos(sin(φ1) * sin(φ2) + cos(φ1) * cos(φ2) * cos(Δλ)) * earth radius.
Number GetDistance(Murl.Util.GeoLocation location)
location | The geo location. |
Calculate the bearing angle between this and a geo locations. The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes. The altitude is not considered.
The formula is for the initial bearing (sometimes referred to as forward azimuth) which if followed in a straight line along a great circle arc will take you from the start point to the end point.
θ = atan2(sin(Δλ) * cos(φ2), cos(φ1) * sin(φ2) − sin(φ1) * cos(φ2) * cos(Δλ)).
Number GetBearing(Murl.Util.GeoLocation location)
location | The geo location. |
Calculate the destination geo location by a given distance and bearing from this location. The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes.
Given a start point, initial bearing, and distance, this will calculate the destination point travelling along a great circle arc.
φ2 = asin(sin(φ1) * cos(d / R) + cos(φ1) * sin(d / R) * cos(θ))
λ2 = λ1 + atan2(sin(θ) * sin(d / R) * cos(φ1), cos(d / R) − sin(φ1) * sin(φ2))
φ is latitude, λ is longitude, θ is the bearing (clockwise from north), d is the distance, R is the earth’s radius (d / R is the angular distance).
Murl.Util.GeoLocation GetDestination(Number distance, Number bearing)
distance | The distance to the destination geo location in meters. |
bearing | The bearing to the destination geo location in degrees. |
The latitude in degrees relative to the equator.
The longitude in degrees relative to the zero meridian.
The altitude above sea level in meters.
The sphere radius in meters, default is the idealized earth radius of 6371000 meters.