Class: Ellipsoid

Ellipsoid

new Ellipsoid(x, y, z)

Ellipsoid class.

Name Type Default Description
x Number 0 optional

The radius value in the X direction.

y Number 0 optional

The radius value in the Y direction.

z Number 0 optional

The radius value in the Z direction.

See:
Throws:

All radius values must be greater than or equal to 0.

Type
DeveloperError

Members

(static, constant) CGCS2000Ellipsoid

The CGCS2000 ellipsoid has radii in the x, y, and z directions of 6378137.0, 6378137.0, and 6356752.31, respectively.

(static, constant) MOONEllipsoid

An Ellipsoid instance is initialized as a sphere with a lunar radius.

static packedLengthNumber

The number of elements used to package objects into an array.

(static, constant) UNIT_SPHEREEllipsoid

Initialize an Ellipsoid instance with a radius of (1.0, 1.0, 1.0).

(static, constant) WGS84Ellipsoid

The instance of the ball defaults to ellipsoidal mode, with radii in the x, y, and z directions set to 6378137, 6378137, 6356752.3142451793, respectively.

Example
SuperMap3D.Ellipsoid.WGS84 = SuperMap3D.freezeObject(new SuperMap3D.Ellipsoid(6378137.0, 6378137.0, 6356752.3142451793));

(static, constant) XIAN80Ellipsoid

The Xi'an 80 ellipsoid has radii in the x, y, and z directions of 6378140.0, 6378140.0, and 6356755.29, respectively.

Example
var ellipsoid = SuperMap3D.Ellipsoid.XIAN80;

readonly maximumRadiusNumber

Obtain the maximum radius of the ellipsoid.

readonly minimumRadiusNumber

Obtain the minimum radius of the ellipsoid.

readonly oneOverRadiiCartesian3

Obtain one within the radius of the ellipsoid.

readonly oneOverRadiiSquaredCartesian3

Take one within the square range of the ellipsoid radius.

readonly radiiCartesian3

Obtain the radius of the ellipsoid.

readonly radiiSquaredCartesian3

Obtain the square radius of the ellipsoid.

readonly radiiToTheFourthCartesian3

Obtain the fourth power of the ellipsoid radius.

Methods

static clone(ellipsoid, result){Ellipsoid}

Copy an ellipsoid instance.

Name Type Description
ellipsoid Ellipsoid

The ellipsoid to be copied.

result Ellipsoid optional

The object for storing results, if a new instance should be created, is undefined.

Returns:
Type Description
Ellipsoid Cloned ellipsoid. (If the ellipsoid is undefined, return undefined)

static fromCartesian3(cartesian, result){Ellipsoid}

Calculate the ellipsoid based on the Cartesian radius specified in the x, y, and z directions.

Name Type Default Description
cartesian Cartesian3 Cartesian3.ZERO optional

The radius of an ellipsoid in the x, y, and z directions.

result Ellipsoid optional

The object for storing results, if a new instance should be created, is undefined.

See:
Throws:

All radii must be greater than or equal to zero.

Type
DeveloperError
Returns:
Type Description
Ellipsoid A new Ellipsoid instance.

static pack(value, array, startingIndex){Array.<Number>}

Store the provided instance in the provided array.

Name Type Default Description
value Ellipsoid

The value to be packaged.

array Array.<Number>

The array to be packaged.

startingIndex Number 0 optional

Start packaging the array index of elements.

Returns:
Type Description
Array.<Number> The loaded array.

static unpack(array, startingIndex, result){Ellipsoid}

Retrieve instances from the packaged array.

Name Type Default Description
array Array.<Number>

Packaged array.

startingIndex Number 0 optional

The starting index of the element to be unpacked.

result Ellipsoid optional

The object that stores the results.

Returns:
Type Description
Ellipsoid Modified result parameters or new ellipsoid instances (if not provided).

cartesianArrayToCartographicArray(cartesians, result){Array.<Cartographic>}

Convert the provided Cartesian array into a projected array.

Name Type Description
cartesians Array.<Cartesian3>

Cartesian position array.

result Array.<Cartographic> optional

The object that stores the results.

Returns:
Type Description
Array.<Cartographic> If no modified result parameters or new Array instances are provided.
Example
//Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
var positions = [new SuperMap3D.Cartesian3(17832.12, 83234.52, 952313.73),
                 new SuperMap3D.Cartesian3(17832.13, 83234.53, 952313.73),
                 new SuperMap3D.Cartesian3(17832.14, 83234.54, 952313.73)]
var cartographicPositions = SuperMap3D.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);

cartesianToCartographic(cartesian, result){Cartographic}

Convert the provided Cartesian coordinates into a projection representation, where Cartesian is undefined at the center of the ellipsoid.

Name Type Description
cartesian Cartesian3

To convert to Cartesian position represented by projection.

result Cartographic optional

The object that stores the results.

Returns:
Type Description
Cartographic The modified result parameters are undefined if no new projection instance is provided or if Cartesian is located at the center of the ellipsoid.
Example
//Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
var position = new SuperMap3D.Cartesian3(17832.12, 83234.52, 952313.73);
var cartographicPosition = SuperMap3D.Ellipsoid.WGS84.cartesianToCartographic(position);

cartographicArrayToCartesianArray(cartographics, result){Array.<Cartesian3>}

Convert the provided projection array into a Cartesian array.

Name Type Description
cartographics Array.<Cartographic>

A set of projection positions.

result Array.<Cartesian3> optional

The object that stores the results.

Returns:
Type Description
Array.<Cartesian3> If no modified result parameters or new Array instances are provided.
Example
//Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
var positions = [new SuperMap3D.Cartographic(SuperMap3D.Math.toRadians(21), SuperMap3D.Math.toRadians(78), 0),
                 new SuperMap3D.Cartographic(SuperMap3D.Math.toRadians(21.321), SuperMap3D.Math.toRadians(78.123), 100),
                 new SuperMap3D.Cartographic(SuperMap3D.Math.toRadians(21.645), SuperMap3D.Math.toRadians(78.456), 250)];
var cartesianPositions = SuperMap3D.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);

cartographicToCartesian(cartographic, result){Cartesian3}

Convert the provided projection to Cartesian representation.

Name Type Description
cartographic Cartographic

Projection position.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 If no modified result parameters or new Cartesian3 instances are provided.
Example
//Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
var position = new SuperMap3D.Cartographic(SuperMap3D.Math.toRadians(21), SuperMap3D.Math.toRadians(78), 5000);
var cartesianPosition = SuperMap3D.Ellipsoid.WGS84.cartographicToCartesian(position);

clone(result){Ellipsoid}

Copy an ellipsoid instance.

Name Type Description
result Ellipsoid optional

The ellipsoid to be copied.

Returns:
Type Description
Ellipsoid The object for storing results, if a new instance should be created, is undefined.

equals(right){Boolean}

Compare this ellipsoid with the provided ellipsoid, return true if they are equal, otherwise return false.

Name Type Description
right Ellipsoid optional

Another ellipsoid.

Returns:
Type Description
Boolean If they are equal, it is true; otherwise, it is false.

geocentricSurfaceNormal(cartesian, result){Cartesian3}

Calculate the unit vector pointing from the center of the ellipsoid to the provided Cartesian position.

Name Type Description
cartesian Cartesian3

Determine the Cartesian normal of the Earth's center.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 If no modified result parameters or new Cartesian3 instances are provided.

geodeticSurfaceNormal(cartesian, result){Cartesian3}

Calculate the plane normal that is tangent to the ellipsoid surface at a given position.

Name Type Description
cartesian Cartesian3

To determine the Cartesian position of the surface normal.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 If no modified result parameters or new Cartesian3 instances are provided, or if normals cannot be found, they are undefined.

geodeticSurfaceNormalCartographic(cartographic, result){Cartesian3}

Calculate the plane normal that is tangent to the ellipsoid surface at a given position.

Name Type Description
cartographic Cartographic

Determine the projection position of the earth's normal.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 If no modified result parameters or new Cartesian3 instances are provided.

getLocalCurvature(surfacePosition, result){Cartesian2}

Calculate the curvature of an ellipsoid given its position on the Earth's surface.

Name Type Description
surfacePosition Cartesian3

The position on the Earth's surface used to calculate the curvature of an ellipsoid.

result Cartesian2 optional

To copy the results to the Cartesian coordinate system, or undefined to create and return a new instance.

Throws:

Location is necessary

Type
DeveloperError
Returns:
Type Description
Cartesian2 Provide the curvature of the location on the ellipsoid surface, with the northeast direction

getSurfaceNormalIntersectionWithZAxis(position, buffer, result){Cartesian|undefined}

Calculate a point that is the intersection of the surface normal and the z-axis.

Name Type Default Description
position Cartesian3

Location. It must be on the surface of an ellipsoid.

buffer Number 0.0 optional

The buffer zone subtracted from the size of the ellipsoid when the checkpoint is within the ellipsoid. In the case of Earth, using a common Earth datum does not require this buffer zone, as the intersection point is always (relatively) very close to the center. In the WGS84 benchmark, the intersection point is located at the maximum z=+-42841.31151313382 (0.673% of the z-axis). If the ratio of MajorAxis/AxisOfRotation is greater than the square root of 2, the intersection point may be outside the ellipsoid

result Cartesian optional

To copy the results to the Cartesian coordinate system, or undefined to create and return a new instance.

Throws:
  • Location is necessary.

    Type
    DeveloperError
  • The ellipsoid must be a rotating ellipsoid (radii. x==radii. y).

    Type
    DeveloperError
  • Ellipsoid.radii.z must be greater than 0.

    Type
    DeveloperError
Returns:
Type Description
Cartesian | undefined If it is inside the ellipsoid, it is the intersection point, otherwise it is undefined.

scaleToGeocentricSurface(cartesian, result){Cartesian3}

Scale the Cartesian position provided along the normal of the Earth's center surface so that it lies on the surface of the ellipsoid.

Name Type Description
cartesian Cartesian3

The Cartesian position to be scaled.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 If no modified result parameters or new Cartesian3 instances are provided.

scaleToGeodeticSurface(cartesian, result){Cartesian3}

Scale the Cartesian position provided along the normal of the earth's surface so that it lies on the surface of the ellipsoid. If the position is at the center of the ellipsoid, this function returns undefined.

Name Type Description
cartesian Cartesian3

The Cartesian position to be scaled.

result Cartesian3 optional

The object that stores the results.

Returns:
Type Description
Cartesian3 The modified result parameter is undefined if no new Cartesian3 instance is provided and the position is in the center.

toString(){String}

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

Returns:
Type Description
String Represent the string of this ellipsoid in the format of '(radii. x, radii. y, radii. z)'.

transformPositionFromScaledSpace(position, result){Cartesian3}

Transform Cartesian X, Y, Z positions from ellipsoid scaling space by multiplying its components with the result of Ellipsoid # radii.

Name Type Description
position Cartesian3

The position to be transformed.

result Cartesian3 optional

To copy the results to a specific location, or undefined to create and return a new instance.

Returns:
Type Description
Cartesian3 The position represented in an unscaled space. If it is not undefined, the returned instance is either the instance passed as a result parameter or its new instance.

transformPositionToScaledSpace(position, result){Cartesian3}

By multiplying its components with the result of Ellipsoid#oneOverRadii, transform the Cartesian X, Y, Z positions into an ellipsoid-scaled space.

Name Type Description
position Cartesian3

The position to be transformed.

result Cartesian3 optional

To copy the results to a specific location, or undefined to create and return a new instance.

Returns:
Type Description
Cartesian3 The position represented in the scaling space. If it is not undefined, the returned instance is either the instance passed as a result parameter or its new instance.