﻿ Euler Math Toolbox - Reference

# Spherical Functions

## Content

Spherical functions for Euler.

## Spherical Geometry

```function spoint (pos:vector)
```
```  Get point on the sqhere from [lat,long] with N>0, S<0, E>0, W<0
Returns a 1x3 vector

File: spherical
```
```function sposprint (pos:vector, sec:integer=0)
```
```  Print [lat,long] in usual form
sec=1 : use DMS
Returns a string

File: spherical
```
```function sposition (point:vector)
```
```  Convert a point on the sphere to a position [lat,long]
Returns a 1x2 vector

File: spherical
```
```function svector (frompos:vector, topos:vector)
```
```  Difference vector of two positions [lat,long] on an ideal ball.
Note that following the direction will not reach the destination
exactly.
Returns [direction,distance], both in radians.

File: spherical

See:   saddvector (Spherical Functions)
```
```function sangle (A:vector, B:vector, C:vector)
```
```  Compute the angle ABC at B on a perfect sphere.

File: spherical
```
```function strianglearea (A:vector, B:vector, C:vector)
```
```  Compute the area of a triangle in space.

File: spherical
```
```function sarea (A:vector, B:vector, C:vector)
```
```  Compute the area of a triangle on a perfect sphere.

File: spherical
```
```function esarea (A:vector, B:vector, C:vector)
```
```  Compute the area of a triangle on the earth
For small triangles this is not very accurate.

File: spherical
```
```function esdist (frompos:vector, topos:vector)
```
```  Distance of two positions [lat,long] on the earth.
This functions uses an average earth radius between the two points.
esdist (earth spherical distance).
Return distance in m

File: spherical
```
```function esdir (frompos:vector, topos:vector)
```
```  Heading between two positions [lat,long] on the earth.
esdirection (earth spherical direction).
Return distance in m

File: spherical
```
```function skmprint (x) := print(x/km\$,digits=3,unit="km")
```
```function sdegprint (x) := print(deg(x),digits=2,unit="°")
```
```function saddvector (pos:vector, heading:vector)
```
```  Add a vector v to a position, all elements in degrees.
This would be the position, which you see in that distance
under that heading from the position pos.
Returns the new position.

File: spherical

See:   svector (Spherical Functions)
```
```function esadd (pos:vector, direction:number, distance:number)
```
```  Add a distance into the direction on the surface of the earth
This will only work exactly for small distances.
Returns the new postion

File: spherical

See:   saddvector (Spherical Functions)
```
```function navigate (P1:vector, P2:vector, n:index=10)
```
```  Navigate from p1 to p2
Prints a series of GPS positions and headings to follow.
```
```function plotearth (lat=-90:30:90, long=0:30:330, labels=1)
```
```  Plots the earth with a grid of coordinates

File: spherical
```
```function plotpos (pos:vector, label="", style="o", col=1)
```
```  Plot a postion and a label

File: spherical
```
```function plotposline (pos, thickness=2, color=1)
```
```  Plot a line of positions

File: spherical
```

Documentation Homepage