# Ellipsoid

#### new Cesium.Ellipsoid(x, y, z)
Core/Ellipsoid.js 63

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.

Name | Type | Default | Description
--- | --- | --- | ---
`x` | Number | `0` | optional The radius in the x direction.
`y` | Number | `0` | optional The radius in the y direction.
`z` | Number | `0` | optional The radius in the z direction.

##### Throws:

- DeveloperError : All radii components must be greater than or equal to zero.

##### See:

- Ellipsoid.fromCartesian3
- Ellipsoid.WGS84
- Ellipsoid.UNIT_SPHERE

### Members

#### static constant Cesium.Ellipsoid.CGCS2000 : Ellipsoid
Core/Ellipsoid.js 227

An Ellipsoid instance initialized to the CGCS2000 standard.

#### static constant Cesium.Ellipsoid.MOON : Ellipsoid
Core/Ellipsoid.js 243

An Ellipsoid instance initialized to a sphere with the lunar radius.

#### static Cesium.Ellipsoid.packedLength : Number
Core/Ellipsoid.js 260

The number of elements used to pack the object into an array.

#### static constant Cesium.Ellipsoid.UNIT_SPHERE : Ellipsoid
Core/Ellipsoid.js 235

An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).

#### static constant Cesium.Ellipsoid.WGS84 : Ellipsoid
Core/Ellipsoid.js 219

An Ellipsoid instance initialized to the WGS84 standard.

#### readonly maximumRadius : Number
Core/Ellipsoid.js 150

Gets the maximum radius of the ellipsoid.

#### readonly minimumRadius : Number
Core/Ellipsoid.js 139

Gets the minimum radius of the ellipsoid.

#### readonly oneOverRadii : Cartesian3
Core/Ellipsoid.js 117

Gets one over the radii of the ellipsoid.

#### readonly oneOverRadiiSquared : Cartesian3
Core/Ellipsoid.js 128

Gets one over the squared radii of the ellipsoid.

#### readonly radii : Cartesian3
Core/Ellipsoid.js 84

Gets the radii of the ellipsoid.

#### readonly radiiSquared : Cartesian3
Core/Ellipsoid.js 95

Gets the squared radii of the ellipsoid.

#### readonly radiiToTheFourth : Cartesian3
Core/Ellipsoid.js 106

Gets the radii of the ellipsoid raise to the fourth power.

### Methods

#### static Cesium.Ellipsoid.clone(ellipsoid, result) → Ellipsoid
Core/Ellipsoid.js 165

Duplicates an Ellipsoid instance.

Name | Type | 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:

The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)

#### static Cesium.Ellipsoid.fromCartesian3(cartesian, result) → Ellipsoid
Core/Ellipsoid.js 200

Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.

Name | Type | Default | Description
--- | --- | --- | ---
`cartesian` | Cartesian3 | `Cartesian3.ZERO` | optional The ellipsoid's radius in the x, y, and z directions.
`result` | Ellipsoid |  | optional The object onto which to store the result, or undefined if a new instance should be created.

##### Returns:

A new Ellipsoid instance.

##### Throws:

- DeveloperError : All radii components must be greater than or equal to zero.

##### See:

- Ellipsoid.WGS84
- Ellipsoid.UNIT_SPHERE

#### static Cesium.Ellipsoid.pack(value, array, startingIndex) → Array.<Number>
Core/Ellipsoid.js 271

Stores the provided instance into the provided array.

Name | Type | Default | Description
--- | --- | --- | ---
`value` | Ellipsoid |  | The value to pack.
`array` | Array.<Number> |  | The array to pack into.
`startingIndex` | Number | `0` | optional The index into the array at which to start packing the elements.

##### Returns:

The array that was packed into

#### static Cesium.Ellipsoid.unpack(array, startingIndex, result) → Ellipsoid
Core/Ellipsoid.js 292

Retrieves an instance from a packed array.

Name | Type | Default | Description
--- | --- | --- | ---
`array` | Array.<Number> |  | The packed array.
`startingIndex` | Number | `0` | optional The starting index of the element to be unpacked.
`result` | Ellipsoid |  | optional The object into which to store the result.

##### Returns:

The modified result parameter or a new Ellipsoid instance if one was not provided.

#### cartesianArrayToCartographicArray(cartesians, result) → Array.<Cartographic>
Core/Ellipsoid.js 477

Converts the provided array of cartesians to an array of cartographics.

Name | Type | Description
--- | --- | ---
`cartesians` | Array.<Cartesian3> | An array of Cartesian positions.
`result` | Array.<Cartographic> | optional The object onto which to store the result.

##### Returns:

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 Cesium.Cartesian3(17832.12, 83234.52, 952313.73),
                     new Cesium.Cartesian3(17832.13, 83234.53, 952313.73),
                     new Cesium.Cartesian3(17832.14, 83234.54, 952313.73)]
    var cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);

#### cartesianToCartographic(cartesian, result) → Cartographic
Core/Ellipsoid.js 439

Converts the provided cartesian to cartographic representation. The cartesian is undefined at the center of the ellipsoid.

Name | Type | Description
--- | --- | ---
`cartesian` | Cartesian3 | The Cartesian position to convert to cartographic representation.
`result` | Cartographic | optional The object onto which to store the result.

##### Returns:

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 Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
    var cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);

#### cartographicArrayToCartesianArray(cartographics, result) → Array.<Cartesian3>
Core/Ellipsoid.js 405

Converts the provided array of cartographics to an array of Cartesians.

Name | Type | Description
--- | --- | ---
`cartographics` | Array.<Cartographic> | An array of cartographic positions.
`result` | Array.<Cartesian3> | optional The object onto which to store the result.

##### Returns:

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 Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 0),
                     new Cesium.Cartographic(Cesium.Math.toRadians(21.321), Cesium.Math.toRadians(78.123), 100),
                     new Cesium.Cartographic(Cesium.Math.toRadians(21.645), Cesium.Math.toRadians(78.456), 250)];
    var cartesianPositions = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);

#### cartographicToCartesian(cartographic, result) → Cartesian3
Core/Ellipsoid.js 375

Converts the provided cartographic to Cartesian representation.

Name | Type | Description
--- | --- | ---
`cartographic` | Cartographic | The cartographic position.
`result` | Cartesian3 | optional The object onto which to store the result.

##### Returns:

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 Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 5000);
    var cartesianPosition = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);

#### clone(result) → Ellipsoid
Core/Ellipsoid.js 252

Duplicates an Ellipsoid instance.

Name | Type | Description
--- | --- | ---
`result` | Ellipsoid | optional The object onto which to store the result, or undefined if a new instance should be created.

##### Returns:

The cloned Ellipsoid.

#### equals(right) → Boolean
Core/Ellipsoid.js 577

Compares this Ellipsoid against the provided Ellipsoid componentwise and returns `true` if they are equal, `false` otherwise.

Name | Type | Description
--- | --- | ---
`right` | Ellipsoid | optional The other Ellipsoid.

##### Returns:

`true` if they are equal, `false` otherwise.

#### geocentricSurfaceNormal(cartesian, result) → Cartesian3
Core/Ellipsoid.js 311

Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.

Name | Type | Description
--- | --- | ---
`cartesian` | Cartesian3 | The Cartesian for which to to determine the geocentric normal.
`result` | Cartesian3 | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new Cartesian3 instance if none was provided.

#### geodeticSurfaceNormal(cartesian, result) → Cartesian3
Core/Ellipsoid.js 349

Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.

Name | Type | 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.

##### Returns:

The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.

#### geodeticSurfaceNormalCartographic(cartographic, result) → Cartesian3
Core/Ellipsoid.js 320

Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.

Name | Type | 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.

##### Returns:

The modified result parameter or a new Cartesian3 instance if none was provided.

#### getLocalCurvature(surfacePosition, result) → Cartesian2
Core/Ellipsoid.js 734

Computes the ellipsoid curvatures at a given position on the surface.

Name | Type | Description
--- | --- | ---
`surfacePosition` | Cartesian3 | The position on the ellipsoid surface where curvatures will be calculated.
`result` | Cartesian2 | optional The cartesian to which to copy the result, or undefined to create and return a new instance.

##### Returns:

The local curvature of the ellipsoid surface at the provided position, in east and north directions.

##### Throws:

- DeveloperError : position is required.

#### getSurfaceNormalIntersectionWithZAxis(position, buffer, result) → Cartesian3|undefined
Core/Ellipsoid.js 606

Computes a point which is the intersection of the surface normal with the z-axis.

Name | Type | Default | Description
--- | --- | --- | ---
`position` | Cartesian3 |  | the position. must be on the surface of the ellipsoid.
`buffer` | Number | `0.0` | optional A buffer to subtract from the ellipsoid size when checking if the point is inside the ellipsoid. In earth case, with common earth datums, there is no need for this buffer since the intersection point is always (relatively) very close to the center. In WGS84 datum, intersection point is at max z = +-42841.31151331382 (0.673% of z-axis). Intersection point could be outside the ellipsoid if the ratio of MajorAxis / AxisOfRotation is bigger than the square root of 2
`result` | Cartesian3 |  | optional The cartesian to which to copy the result, or undefined to create and return a new instance.

##### Returns:

the intersection point if it's inside the ellipsoid, undefined otherwise

##### Throws:

- DeveloperError : position is required.
- DeveloperError : Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y).
- DeveloperError : Ellipsoid.radii.z must be greater than 0.

#### scaleToGeocentricSurface(cartesian, result) → Cartesian3
Core/Ellipsoid.js 515

Scales the provided Cartesian position along the geocentric surface normal so that it is on the surface of this ellipsoid.

Name | Type | Description
--- | --- | ---
`cartesian` | Cartesian3 | The Cartesian position to scale.
`result` | Cartesian3 | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new Cartesian3 instance if none was provided.

#### scaleToGeodeticSurface(cartesian, result) → Cartesian3
Core/Ellipsoid.js 503

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.

Name | Type | Description
--- | --- | ---
`cartesian` | Cartesian3 | The Cartesian position to scale.
`result` | Cartesian3 | optional The object onto which to store the result.

##### Returns:

The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.

#### surfaceArea(rectangle) → Number
Core/Ellipsoid.js 689

Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using Gauss-Legendre 10th order quadrature.

Name | Type | Description
--- | --- | ---
`rectangle` | Rectangle | The rectangle used for computing the surface area.

##### Returns:

The approximate area of the rectangle on the surface of this ellipsoid.

#### toString() → String
Core/Ellipsoid.js 586

Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.

##### Returns:

A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.

#### transformPositionFromScaledSpace(position, result) → Cartesian3
Core/Ellipsoid.js 562

Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying its components by the result of `Ellipsoid#radii`.

Name | Type | 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:

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(position, result) → Cartesian3
Core/Ellipsoid.js 544

Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying its components by the result of `Ellipsoid#oneOverRadii`.

Name | Type | 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:

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.