Appearance
KBE3D / KBCore / Cesium / Ellipsoid
类: Ellipsoid
A quadratic surface defined in Cartesian coordinates by the equation <code>(x / a)^2 + (y / b)^2 + (z / c)^2 = 1</code>. 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.
参数
The radius in the x direction.
参数
The radius in the y direction.
参数
The radius in the z direction.
属性
WGS84
readonlystaticWGS84:Ellipsoid
An Ellipsoid instance initialized to the WGS84 standard.
UNIT_SPHERE
readonlystaticUNIT_SPHERE:Ellipsoid
An Ellipsoid instance initialized to radii of (1.0, 1.0, 1.0).
MOON
readonlystaticMOON:Ellipsoid
An Ellipsoid instance initialized to a sphere with the lunar radius.
MARS
readonlystaticMARS:Ellipsoid
An Ellipsoid instance initialized to a sphere with the mean radii of Mars. Source: https://epsg.io/104905
default
staticdefault:Ellipsoid
The default ellipsoid used when not otherwise specified.
示例
ts
Cesium.Ellipsoid.default = Cesium.Ellipsoid.MOON;
// Apollo 11 landing site
const position = Cesium.Cartesian3.fromRadians(
0.67416,
23.47315,
);packedLength
staticpackedLength:number
The number of elements used to pack the object into an array.
radii
readonlyradii:Cartesian3
Gets the radii of the ellipsoid.
radiiSquared
readonlyradiiSquared:Cartesian3
Gets the squared radii of the ellipsoid.
radiiToTheFourth
readonlyradiiToTheFourth:Cartesian3
Gets the radii of the ellipsoid raise to the fourth power.
oneOverRadii
readonlyoneOverRadii:Cartesian3
Gets one over the radii of the ellipsoid.
oneOverRadiiSquared
readonlyoneOverRadiiSquared:Cartesian3
Gets one over the squared radii of the ellipsoid.
minimumRadius
readonlyminimumRadius:number
Gets the minimum radius of the ellipsoid.
maximumRadius
readonlymaximumRadius:number
Gets the maximum radius of the ellipsoid.
方法
clone()
staticclone(ellipsoid:Ellipsoid,result?:Ellipsoid):Ellipsoid
Duplicates an Ellipsoid instance.
参数
ellipsoid
Ellipsoid
The ellipsoid to duplicate.
result?
Ellipsoid
The object onto which to store the result, or undefined if a new instance should be created.
返回
Ellipsoid
The cloned Ellipsoid. (Returns undefined if ellipsoid is undefined)
fromCartesian3()
staticfromCartesian3(cartesian?:Cartesian3,result?:Ellipsoid):Ellipsoid
Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions.
参数
cartesian?
The ellipsoid's radius in the x, y, and z directions.
result?
Ellipsoid
The object onto which to store the result, or undefined if a new instance should be created.
返回
Ellipsoid
A new Ellipsoid instance.
pack()
staticpack(value:Ellipsoid,array:number[],startingIndex?:number):number[]
Stores the provided instance into the provided array.
参数
value
Ellipsoid
The value to pack.
array
number[]
The array to pack into.
startingIndex?
number
The index into the array at which to start packing the elements.
返回
number[]
The array that was packed into
unpack()
staticunpack(array:number[],startingIndex?:number,result?:Ellipsoid):Ellipsoid
Retrieves an instance from a packed array.
参数
array
number[]
The packed array.
startingIndex?
number
The starting index of the element to be unpacked.
result?
Ellipsoid
The object into which to store the result.
返回
Ellipsoid
The modified result parameter or a new Ellipsoid instance if one was not provided.
clone()
clone(
result?:Ellipsoid):Ellipsoid
Duplicates an Ellipsoid instance.
参数
result?
Ellipsoid
The object onto which to store the result, or undefined if a new instance should be created.
返回
Ellipsoid
The cloned Ellipsoid.
geocentricSurfaceNormal()
geocentricSurfaceNormal(
cartesian:Cartesian3,result?:Cartesian3):Cartesian3
Computes the unit vector directed from the center of this ellipsoid toward the provided Cartesian position.
参数
cartesian
The Cartesian for which to to determine the geocentric normal.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Cartesian3 instance if none was provided.
geodeticSurfaceNormalCartographic()
geodeticSurfaceNormalCartographic(
cartographic:Cartographic,result?:Cartesian3):Cartesian3
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
参数
cartographic
The cartographic position for which to to determine the geodetic normal.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Cartesian3 instance if none was provided.
geodeticSurfaceNormal()
geodeticSurfaceNormal(
cartesian:Cartesian3,result?:Cartesian3):Cartesian3
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
参数
cartesian
The Cartesian position for which to to determine the surface normal.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
cartographicToCartesian()
cartographicToCartesian(
cartographic:Cartographic,result?:Cartesian3):Cartesian3
Converts the provided cartographic to Cartesian representation.
参数
cartographic
The cartographic position.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Cartesian3 instance if none was provided.
示例
ts
//Create a Cartographic and determine it's Cartesian representation on a WGS84 ellipsoid.
const position = new Cesium.Cartographic(Cesium.Math.toRadians(21), Cesium.Math.toRadians(78), 5000);
const cartesianPosition = Cesium.Ellipsoid.WGS84.cartographicToCartesian(position);cartographicArrayToCartesianArray()
cartographicArrayToCartesianArray(
cartographics:Cartographic[],result?:Cartesian3[]):Cartesian3[]
Converts the provided array of cartographics to an array of Cartesians.
参数
cartographics
An array of cartographic positions.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Array instance if none was provided.
示例
ts
//Convert an array of Cartographics and determine their Cartesian representation on a WGS84 ellipsoid.
const 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)];
const cartesianPositions = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray(positions);cartesianToCartographic()
cartesianToCartographic(
cartesian:Cartesian3,result?:Cartographic):Cartographic
Converts the provided cartesian to cartographic representation. The cartesian is undefined at the center of the ellipsoid.
参数
cartesian
The Cartesian position to convert to cartographic representation.
result?
The object onto which to store the result.
返回
The modified result parameter, new Cartographic instance if none was provided, or undefined if the cartesian is at the center of the ellipsoid.
示例
ts
//Create a Cartesian and determine it's Cartographic representation on a WGS84 ellipsoid.
const position = new Cesium.Cartesian3(17832.12, 83234.52, 952313.73);
const cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);cartesianArrayToCartographicArray()
cartesianArrayToCartographicArray(
cartesians:Cartesian3[],result?:Cartographic[]):Cartographic[]
Converts the provided array of cartesians to an array of cartographics.
参数
cartesians
An array of Cartesian positions.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Array instance if none was provided.
示例
ts
//Create an array of Cartesians and determine their Cartographic representation on a WGS84 ellipsoid.
const 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)]
const cartographicPositions = Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray(positions);scaleToGeodeticSurface()
scaleToGeodeticSurface(
cartesian:Cartesian3,result?:Cartesian3):Cartesian3
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.
参数
cartesian
The Cartesian position to scale.
result?
The object onto which to store the result.
返回
The modified result parameter, a new Cartesian3 instance if none was provided, or undefined if the position is at the center.
scaleToGeocentricSurface()
scaleToGeocentricSurface(
cartesian:Cartesian3,result?:Cartesian3):Cartesian3
Scales the provided Cartesian position along the geocentric surface normal so that it is on the surface of this ellipsoid.
参数
cartesian
The Cartesian position to scale.
result?
The object onto which to store the result.
返回
The modified result parameter or a new Cartesian3 instance if none was provided.
transformPositionToScaledSpace()
transformPositionToScaledSpace(
position:Cartesian3,result?:Cartesian3):Cartesian3
Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying its components by the result of Ellipsoid#oneOverRadii.
参数
position
The position to transform.
result?
The position to which to copy the result, or undefined to create and return a new instance.
返回
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.
transformPositionFromScaledSpace()
transformPositionFromScaledSpace(
position:Cartesian3,result?:Cartesian3):Cartesian3
Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying its components by the result of Ellipsoid#radii.
参数
position
The position to transform.
result?
The position to which to copy the result, or undefined to create and return a new instance.
返回
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.
equals()
equals(
right?:Ellipsoid):boolean
Compares this Ellipsoid against the provided Ellipsoid componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
right?
Ellipsoid
The other Ellipsoid.
返回
boolean
true if they are equal, false otherwise.
toString()
toString():
string
Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'.
返回
string
A string representing this ellipsoid in the format '(radii.x, radii.y, radii.z)'.
getSurfaceNormalIntersectionWithZAxis()
getSurfaceNormalIntersectionWithZAxis(
position:Cartesian3,buffer?:number,result?:Cartesian3):Cartesian3|undefined
Computes a point which is the intersection of the surface normal with the z-axis.
参数
position
the position. must be on the surface of the ellipsoid.
buffer?
number
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?
The cartesian to which to copy the result, or undefined to create and return a new instance.
返回
Cartesian3 | undefined
the intersection point if it's inside the ellipsoid, undefined otherwise
getLocalCurvature()
getLocalCurvature(
surfacePosition:Cartesian3,result?:Cartesian2):Cartesian2
Computes the ellipsoid curvatures at a given position on the surface.
参数
surfacePosition
The position on the ellipsoid surface where curvatures will be calculated.
result?
The cartesian to which to copy the result, or undefined to create and return a new instance.
返回
The local curvature of the ellipsoid surface at the provided position, in east and north directions.
surfaceArea()
surfaceArea(
rectangle:Rectangle):number
Computes an approximation of the surface area of a rectangle on the surface of an ellipsoid using Gauss-Legendre 10th order quadrature.
参数
rectangle
The rectangle used for computing the surface area.
返回
number
The approximate area of the rectangle on the surface of this ellipsoid.
构造函数
构造函数
new Ellipsoid(
x?:number,y?:number,z?:number):Ellipsoid
参数
x?
number
y?
number
z?
number
返回
Ellipsoid
