Class Index | File Index

Classes


Namespace geo.math


Defined in: extensions.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
geo.math.EARTH_RADIUS
The radius of the Earth, in meters, assuming the Earth is a perfect sphere.
Method Summary
Method Attributes Method Name and Description
<static>  
geo.math.bearing(start, dest)
<static>  
geo.math.constrainValue(value, range)
Constrains the given number to the given range.
<static>  
geo.math.destination(start, options)
Calculates the destination point along a geodesic, given an initial heading and distance, from the given start point.
<static>  
geo.math.distance(point1, point2)
Returns the approximate sea level great circle (Earth) distance between two points using the Haversine formula and assuming an Earth radius of geo.math.EARTH_RADIUS.
<static>  
geo.math.heading(start, dest)
Calculates the initial heading/bearing at which an object at the start point will need to travel to get to the destination point.
<static>  
geo.math.midpoint(point1, point2, fraction)
Calculates an intermediate point on the geodesic between the two given points.
<static>  
geo.math.normalizeAngle(angleRad)
Normalizes an angle to the [0,2pi) range.
<static>  
geo.math.normalizeLat(lat)
Normalizes a latitude to the [-90,90] range.
<static>  
geo.math.normalizeLng(lng)
Normalizes a longitude to the [-180,180] range.
<static>  
geo.math.reverseAngle(angleRad)
Reverses an angle.
<static>  
geo.math.wrapValue(value, range, favorMin)
Wraps the given number to the given range.
Namespace Detail
geo.math
Field Detail
<static> {Number} geo.math.EARTH_RADIUS
The radius of the Earth, in meters, assuming the Earth is a perfect sphere.
See:
http://en.wikipedia.org/wiki/Earth_radius
Method Detail
<static> {Number} geo.math.bearing(start, dest)
Parameters:
{geo.Point} start
{geo.Point} dest
Returns:
{Number}
See:
geo.math.heading

<static> {Number} geo.math.constrainValue(value, range)
Constrains the given number to the given range.
Parameters:
{Number} value
The value to constrain.
{Number[]} range
An array of two numbers, specifying the minimum and maximum bounds of the range, respectively.
Returns:
{Number} Returns the value constrained to the given range.

<static> {geo.Point} geo.math.destination(start, options)
Calculates the destination point along a geodesic, given an initial heading and distance, from the given start point.
Parameters:
{geo.Point} start
The start point.
{Object} options
The heading and distance object literal.
{Number} options.heading
The initial heading, in degrees.
{Number} options.distance
The distance along the geodesic, in meters.
Returns:
{geo.Point}
See:
http://www.movable-type.co.uk/scripts/latlong.html

<static> {Number} geo.math.distance(point1, point2)
Returns the approximate sea level great circle (Earth) distance between two points using the Haversine formula and assuming an Earth radius of geo.math.EARTH_RADIUS.
Parameters:
{geo.Point} point1
The first point.
{geo.Point} point2
The second point.
Returns:
{Number} The Earth distance between the two points, in meters.
See:
http://www.movable-type.co.uk/scripts/latlong.html

<static> {Number} geo.math.heading(start, dest)
Calculates the initial heading/bearing at which an object at the start point will need to travel to get to the destination point.
Parameters:
{geo.Point} start
The start point.
{geo.Point} dest
The destination point.
Returns:
{Number} The initial heading required to get to the destination point, in the [0,360) degree range.
See:
http://mathforum.org/library/drmath/view/55417.html

<static> {geo.Point} geo.math.midpoint(point1, point2, fraction)
Calculates an intermediate point on the geodesic between the two given points.
Parameters:
{geo.Point} point1
The first point.
{geo.Point} point2
The second point.
{Number} fraction Optional
The fraction of distance between the first and second points.
Returns:
{geo.Point}
See:
http://williams.best.vwh.net/avform.htm#Intermediate

<static> {Number} geo.math.normalizeAngle(angleRad)
Normalizes an angle to the [0,2pi) range.
Parameters:
{Number} angleRad
The angle to normalize, in radians.
Returns:
Returns the angle, fit within the [0,2pi) range, in radians.

<static> {Number} geo.math.normalizeLat(lat)
Normalizes a latitude to the [-90,90] range. Latitudes above 90 or below -90 are capped, not wrapped.
Parameters:
{Number} lat
The latitude to normalize, in degrees.
Returns:
Returns the latitude, fit within the [-90,90] range.

<static> {Number} geo.math.normalizeLng(lng)
Normalizes a longitude to the [-180,180] range. Longitudes above 180 or below -180 are wrapped.
Parameters:
{Number} lng
The longitude to normalize, in degrees.
Returns:
Returns the latitude, fit within the [-90,90] range.

<static> {Number} geo.math.reverseAngle(angleRad)
Reverses an angle.
Parameters:
{Number} angleRad
The angle to reverse, in radians.
Returns:
Returns the reverse angle, in radians.

<static> {Number} geo.math.wrapValue(value, range, favorMin)
Wraps the given number to the given range. If the wrapped value is exactly equal to min or max, favors max, unless favorMin is true.
Parameters:
{Number} value
The value to wrap.
{Number[]} range
An array of two numbers, specifying the minimum and maximum bounds of the range, respectively.
{Boolean} favorMin Optional, Default: false
Whether or not to favor min over max in the case of ambiguity.
Returns:
{Number} Returns the value wrapped to the given range.

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Oct 30 2012 11:34:31 GMT-0700 (PDT)