new Ellipsoid
A quadratic surface defined in Cartesian coordinates by the equation
(x / a)^2 + (y / b)^2 + (z / c)^2 = 1
. Primarily used
by Cesium to represent the shape of planetary bodies.
Rather than constructing this object directly, one of the provided
constants is normally used.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x |
Number |
<optional> |
0 | The radius in the x direction. |
y |
Number |
<optional> |
0 | The radius in the y direction. |
z |
Number |
<optional> |
0 | The radius in the z direction. |
Throws:
Members
-
geocentricSurfaceNormal :DeveloperError
-
Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
-
<static> MOON
-
An Ellipsoid instance initialized to a sphere with the lunar radius.
-
<static> UNIT_SPHERE
-
An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
-
<static> WGS84
-
An Ellipsoid instance initialized to the WGS84 standard.
Methods
-
cartesianArrayToCartographicArray
-
Converts the provided array of cartesians to an array of cartographics.
Parameters:
Name Type Argument Description cartesians
Array An array of Cartesian positions. result
Array <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesians is required.Returns:
Array The modified result parameter or a new Array instance if none was provided.Example
//Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid. var positions = [new Cartesian(17832.12, 83234.52, 952313.73), new Cartesian(17832.13, 83234.53, 952313.73), new Cartesian(17832.14, 83234.54, 952313.73)] var cartographicPositions = Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);
-
cartesianToCartographic
-
Converts the provided cartesian to cartographic representation. The cartesian is undefined at the center of the ellipsoid.
Parameters:
Name Type Argument Description cartesian
Cartesian3 The Cartesian position to convert to cartographic representation. result
Cartographic <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartographic The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.Example
//Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid. var position = new Cartesian(17832.12, 83234.52, 952313.73); var cartographicPosition = Ellipsoid.WGS84.cartesianToCartographic(position);
-
cartographicArrayToCartesianArray
-
Converts the provided array of cartographics to an array of Cartesians.
Parameters:
Name Type Argument Description cartographics
Array An array of cartographic positions. result
Array <optional>
The object onto which to store the result. Throws:
DeveloperError : cartographics is required.Returns:
Array The modified result parameter or a new Array instance if none was provided.Example
//Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid. var positions = [new Cartographic(Math.toRadians(21), Math.toRadians(78), 0), new Cartographic(Math.toRadians(21.321), Math.toRadians(78.123), 100), new Cartographic(Math.toRadians(21.645), Math.toRadians(78.456), 250) var cartesianPositions = Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);
-
cartographicToCartesian
-
Converts the provided cartographic to Cartesian representation.
Parameters:
Name Type Argument Description cartographic
Cartographic The cartographic position. result
Cartesian3 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartographic is required.Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if none was provided.Example
//Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid. var position = new Cartographic(Math.toRadians(21), Math.toRadians(78), 5000); var cartesianPosition = Ellipsoid.WGS84.cartographicToCartesian(position);
-
clone
-
Duplicates an Ellipsoid instance.
Parameters:
Name Type Argument Description result
Ellipsoid <optional>
The object onto which to store the result, or undefined if a new instance should be created. Returns:
Ellipsoid The cloned Ellipsoid. -
equals
-
Compares this Ellipsoid against the provided Ellipsoid componentwise and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument Description right
Ellipsoid <optional>
The other Ellipsoid. Returns:
Booleantrue
if they are equal,false
otherwise. -
geodeticSurfaceNormal
-
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
Parameters:
Name Type Argument Description cartesian
Cartesian3 The Cartesian position for which to to determine the surface normal. result
Cartesian3 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if none was provided. -
geodeticSurfaceNormalCartographic
-
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
Parameters:
Name Type Argument Description cartographic
Cartographic The cartographic position for which to to determine the geodetic normal. result
Cartesian3 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartographic is required.Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if none was provided. -
getMaximumRadius
-
Returns:
Cartesian3 The maximum radius of the ellipsoid. -
getMinimumRadius
-
Returns:
Cartesian3 The minimum radius of the ellipsoid. -
getOneOverRadii
-
Returns:
Cartesian3 One over the radii of the ellipsoid. -
getOneOverRadiiSquared
-
Returns:
Cartesian3 One over the squared radii of the ellipsoid. -
getRadii
-
Returns:
Cartesian3 The radii of the ellipsoid. -
getRadiiSquared
-
Returns:
Cartesian3 The squared radii of the ellipsoid. -
getRadiiToTheFourth
-
Returns:
Cartesian3 The radii of the ellipsoid raised to the fourth power. -
scaleToGeocentricSurface
-
Scales the provided Cartesian position along the geocentric surface normal so that it is on the surface of this ellipsoid.
Parameters:
Name Type Argument Description cartesian
Cartesian3 The Cartesian position to scale. result
Cartesian3 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if none was provided. -
scaleToGeodeticSurface
-
Scales the provided Cartesian position along the geodetic surface normal so that it is on the surface of this ellipsoid. If the position is at the center of the ellipsoid, this function returns undefined.
Parameters:
Name Type Argument Description cartesian
Cartesian3 The Cartesian position to scale. result
Cartesian3 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartesian3 The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center. -
toString
-
Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
Returns:
String A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'. -
transformPositionFromScaledSpace
-
Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying its components by the result of Ellipsoid#getRadii.
Parameters:
Name Type Argument Description position
Cartesian3 The position to transform. result
Cartesian3 <optional>
The position to which to copy the result, or undefined to create and return a new instance. Returns:
Cartesian3 The position expressed in the unscaled space. The returned instance is the one passed as the result parameter if it is not undefined, or a new instance of it is. -
transformPositionToScaledSpace
-
Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying its components by the result of Ellipsoid#getOneOverRadii.
Parameters:
Name Type Argument Description position
Cartesian3 The position to transform. result
Cartesian3 <optional>
The position to which to copy the result, or undefined to create and return a new instance. Returns:
Cartesian3 The position expressed in the scaled space. The returned instance is the one passed as the result parameter if it is not undefined, or a new instance of it is. -
<static> clone
-
Duplicates an Ellipsoid instance.
Parameters:
Name Type Argument Description ellipsoid
Ellipsoid The ellipsoid to duplicate. result
Ellipsoid <optional>
The object onto which to store the result, or undefined if a new instance should be created. Returns:
Ellipsoid The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined) -
<static> fromCartesian3
-
Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
Parameters:
Name Type Argument Default Description radii
Cartesian3 <optional>
Cartesian3.ZERO The ellipsoid's radius in the x, y, and z directions. Throws:
DeveloperError : All radii components must be greater than or equal to zero.Returns:
Ellipsoid A new Ellipsoid instance.