Method Summary |
|---|
|
isArray
(
arg
)
Determines if the argument is an array
|
|
radians
(
degrees
)
Converts degrees to radians
|
|
degrees
(
radians
)
Converts radians to degrees
|
|
normalize
(
lon
)
Normalizes a longitude value to be within -180 to 180
|
|
constrainLat
(
lat
)
Constrains a latitude to be within -90 to 90
|
|
greatCircleLat
(
lat0
,
lon0
,
lat1
,
lon1
,
lon2
)
Given two coordinates and a third longitude, Calculates the latitude value of the third point so that all 3 points lie along the same great circle.
|
|
Math.sinh
(
angle
)
Calculates the hyperbolic sine of an angle
|
|
Math.cosh
(
angle
)
Calculates the hyperbolic cosine of an angle
|
|
Math.nint
(
value
,
round
)
Converts a number to an integer, with optional rounding.
|
|
Math.sqrDist
(
pt1
,
pt2
)
Calculates the square of the distance between two points
|
var yes = isArray(new Array(3)); // returns true
var no = isArray(3); // returns false
var twopi = radians(360);
// Converts 360 degrees to its radian equivalent, = 2*pi
var threesixty = degrees(2*3.14159);
// Converts two pi to its degree equivalent, = 360
lon1 = 185; lon2 = normalize(lon1);
// lon2 will have the value -175
lona[0] = 185; status = normalize(lona);
// lona[0] will be overwritten with -175, status will be true
err = normalize('hi');
// err will be false
lon1 = constrainLat(50); // lon1 will be 50
lon2 = constrainLat(100); // lon2 will be 90
lat3 = greatCircleLat(30,30, 40,40, 50);
// Calculates lat3 so it will be along the same great circle
// as 30,30 and 40,40 at the place where the great circle
// intersects longitude 50
z = Math.sinh(someangle);
z = Math.cosh(someangle);
a = Math.nint(1.6, false); // a will be 1
b = Math.nint(1.6, true); // b will be 2
c = Math.nint(1.6); // c will be 1
var pt1 = {x:1, y:2};
var pt2 = {x:4, y:6};
var sd = Math.sqrDist(pt1, pt2);
// sd will be 25