Appearance
KBE3D / KBCore / Cesium / Cartesian3
类: Cartesian3
A 3D Cartesian point.
参数
The X component.
参数
The Y component.
参数
The Z component.
属性
packedLength
staticpackedLength:number
The number of elements used to pack the object into an array.
ZERO
readonlystaticZERO:Cartesian3
An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
ONE
readonlystaticONE:Cartesian3
An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
UNIT_X
readonlystaticUNIT_X:Cartesian3
An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
UNIT_Y
readonlystaticUNIT_Y:Cartesian3
An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
UNIT_Z
readonlystaticUNIT_Z:Cartesian3
An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
x
x:
number
The X component.
y
y:
number
The Y component.
z
z:
number
The Z component.
方法
fromSpherical()
staticfromSpherical(spherical:Spherical,result?:Cartesian3):Cartesian3
Converts the provided Spherical into Cartesian3 coordinates.
参数
spherical
The Spherical to be converted to Cartesian3.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
fromElements()
staticfromElements(x:number,y:number,z:number,result?:Cartesian3):Cartesian3
Creates a Cartesian3 instance from x, y and z coordinates.
参数
x
number
The x coordinate.
y
number
The y coordinate.
z
number
The z coordinate.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
clone()
staticclone(cartesian:Cartesian3,result?:Cartesian3):Cartesian3
Duplicates a Cartesian3 instance.
参数
cartesian
Cartesian3
The Cartesian to duplicate.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)
pack()
staticpack(value:Cartesian3,array:number[] |TypedArray,startingIndex?:number):number[] |TypedArray
Stores the provided instance into the provided array.
参数
value
Cartesian3
The value to pack.
array
The array to pack into.
number[] | TypedArray
startingIndex?
number
The index into the array at which to start packing the elements.
返回
number[] | TypedArray
The array that was packed into
unpack()
staticunpack(array:number[] |TypedArray,startingIndex?:number,result?:Cartesian3):Cartesian3
Retrieves an instance from a packed array.
参数
array
The packed array.
number[] | TypedArray
startingIndex?
number
The starting index of the element to be unpacked.
result?
Cartesian3
The object into which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
packArray()
staticpackArray(array:Cartesian3[],result?:number[] |TypedArray):number[] |TypedArray
Flattens an array of Cartesian3s into an array of components.
参数
array
Cartesian3[]
The array of cartesians to pack.
result?
The array onto which to store the result. If this is a typed array, it must have array.length * 3 components, else a DeveloperError will be thrown. If it is a regular array, it will be resized to have (array.length * 3) elements.
number[] | TypedArray
返回
number[] | TypedArray
The packed array.
unpackArray()
staticunpackArray(array:number[] |TypedArray,result?:Cartesian3[]):Cartesian3[]
Unpacks an array of cartesian components into an array of Cartesian3s.
参数
array
The array of components to unpack.
number[] | TypedArray
result?
Cartesian3[]
The array onto which to store the result.
返回
Cartesian3[]
The unpacked array.
maximumComponent()
staticmaximumComponent(cartesian:Cartesian3):number
Computes the value of the maximum component for the supplied Cartesian.
参数
cartesian
Cartesian3
The cartesian to use.
返回
number
The value of the maximum component.
minimumComponent()
staticminimumComponent(cartesian:Cartesian3):number
Computes the value of the minimum component for the supplied Cartesian.
参数
cartesian
Cartesian3
The cartesian to use.
返回
number
The value of the minimum component.
minimumByComponent()
staticminimumByComponent(first:Cartesian3,second:Cartesian3,result:Cartesian3):Cartesian3
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
参数
first
Cartesian3
A cartesian to compare.
second
Cartesian3
A cartesian to compare.
result
Cartesian3
The object into which to store the result.
返回
Cartesian3
A cartesian with the minimum components.
maximumByComponent()
staticmaximumByComponent(first:Cartesian3,second:Cartesian3,result:Cartesian3):Cartesian3
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
参数
first
Cartesian3
A cartesian to compare.
second
Cartesian3
A cartesian to compare.
result
Cartesian3
The object into which to store the result.
返回
Cartesian3
A cartesian with the maximum components.
clamp()
staticclamp(value:Cartesian3,min:Cartesian3,max:Cartesian3,result:Cartesian3):Cartesian3
Constrain a value to lie between two values.
参数
value
Cartesian3
The value to clamp.
min
Cartesian3
The minimum bound.
max
Cartesian3
The maximum bound.
result
Cartesian3
The object into which to store the result.
返回
Cartesian3
The clamped value such that min <= value <= max.
magnitudeSquared()
staticmagnitudeSquared(cartesian:Cartesian3):number
Computes the provided Cartesian's squared magnitude.
参数
cartesian
Cartesian3
The Cartesian instance whose squared magnitude is to be computed.
返回
number
The squared magnitude.
magnitude()
staticmagnitude(cartesian:Cartesian3):number
Computes the Cartesian's magnitude (length).
参数
cartesian
Cartesian3
The Cartesian instance whose magnitude is to be computed.
返回
number
The magnitude.
distance()
staticdistance(left:Cartesian3,right:Cartesian3):number
Computes the distance between two points.
参数
left
Cartesian3
The first point to compute the distance from.
right
Cartesian3
The second point to compute the distance to.
返回
number
The distance between two points.
示例
ts
// Returns 1.0
const d = Cesium.Cartesian3.distance(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(2.0, 0.0, 0.0));distanceSquared()
staticdistanceSquared(left:Cartesian3,right:Cartesian3):number
Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using Cartesian3#distance.
参数
left
Cartesian3
The first point to compute the distance from.
right
Cartesian3
The second point to compute the distance to.
返回
number
The distance between two points.
示例
ts
// Returns 4.0, not 2.0
const d = Cesium.Cartesian3.distanceSquared(new Cesium.Cartesian3(1.0, 0.0, 0.0), new Cesium.Cartesian3(3.0, 0.0, 0.0));normalize()
staticnormalize(cartesian:Cartesian3,result:Cartesian3):Cartesian3
Computes the normalized form of the supplied Cartesian.
参数
cartesian
Cartesian3
The Cartesian to be normalized.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
dot()
staticdot(left:Cartesian3,right:Cartesian3):number
Computes the dot (scalar) product of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
返回
number
The dot product.
multiplyComponents()
staticmultiplyComponents(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the componentwise product of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
divideComponents()
staticdivideComponents(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the componentwise quotient of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
add()
staticadd(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the componentwise sum of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
subtract()
staticsubtract(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the componentwise difference of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
multiplyByScalar()
staticmultiplyByScalar(cartesian:Cartesian3,scalar:number,result:Cartesian3):Cartesian3
Multiplies the provided Cartesian componentwise by the provided scalar.
参数
cartesian
Cartesian3
The Cartesian to be scaled.
scalar
number
The scalar to multiply with.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
divideByScalar()
staticdivideByScalar(cartesian:Cartesian3,scalar:number,result:Cartesian3):Cartesian3
Divides the provided Cartesian componentwise by the provided scalar.
参数
cartesian
Cartesian3
The Cartesian to be divided.
scalar
number
The scalar to divide by.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
negate()
staticnegate(cartesian:Cartesian3,result:Cartesian3):Cartesian3
Negates the provided Cartesian.
参数
cartesian
Cartesian3
The Cartesian to be negated.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
abs()
staticabs(cartesian:Cartesian3,result:Cartesian3):Cartesian3
Computes the absolute value of the provided Cartesian.
参数
cartesian
Cartesian3
The Cartesian whose absolute value is to be computed.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
lerp()
staticlerp(start:Cartesian3,end:Cartesian3,t:number,result:Cartesian3):Cartesian3
Computes the linear interpolation or extrapolation at t using the provided cartesians.
参数
start
Cartesian3
The value corresponding to t at 0.0.
end
Cartesian3
The value corresponding to t at 1.0.
t
number
The point along t at which to interpolate.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter.
angleBetween()
staticangleBetween(left:Cartesian3,right:Cartesian3):number
Returns the angle, in radians, between the provided Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
返回
number
The angle between the Cartesians.
mostOrthogonalAxis()
staticmostOrthogonalAxis(cartesian:Cartesian3,result:Cartesian3):Cartesian3
Returns the axis that is most orthogonal to the provided Cartesian.
参数
cartesian
Cartesian3
The Cartesian on which to find the most orthogonal axis.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The most orthogonal axis.
projectVector()
staticprojectVector(a:Cartesian3,b:Cartesian3,result:Cartesian3):Cartesian3
Projects vector a onto vector b
参数
a
Cartesian3
The vector that needs projecting
b
Cartesian3
The vector to project onto
result
Cartesian3
The result cartesian
返回
Cartesian3
The modified result parameter
equals()
staticequals(left?:Cartesian3,right?:Cartesian3):boolean
Compares the provided Cartesians componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
left?
Cartesian3
The first Cartesian.
right?
Cartesian3
The second Cartesian.
返回
boolean
true if left and right are equal, false otherwise.
equalsEpsilon()
staticequalsEpsilon(left?:Cartesian3,right?:Cartesian3,relativeEpsilon?:number,absoluteEpsilon?:number):boolean
Compares the provided Cartesians componentwise and returns <code>true</code> if they pass an absolute or relative tolerance test, <code>false</code> otherwise.
参数
left?
Cartesian3
The first Cartesian.
right?
Cartesian3
The second Cartesian.
relativeEpsilon?
number
The relative epsilon tolerance to use for equality testing.
absoluteEpsilon?
number
The absolute epsilon tolerance to use for equality testing.
返回
boolean
true if left and right are within the provided epsilon, false otherwise.
cross()
staticcross(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the cross (outer) product of two Cartesians.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The cross product.
midpoint()
staticmidpoint(left:Cartesian3,right:Cartesian3,result:Cartesian3):Cartesian3
Computes the midpoint between the right and left Cartesian.
参数
left
Cartesian3
The first Cartesian.
right
Cartesian3
The second Cartesian.
result
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The midpoint.
fromDegrees()
staticfromDegrees(longitude:number,latitude:number,height?:number,ellipsoid?:Ellipsoid,result?:Cartesian3):Cartesian3
Returns a Cartesian3 position from longitude and latitude values given in degrees.
参数
longitude
number
The longitude, in degrees
latitude
number
The latitude, in degrees
height?
number
The height, in meters, above the ellipsoid.
ellipsoid?
The ellipsoid on which the position lies.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The position
示例
ts
const position = Cesium.Cartesian3.fromDegrees(-115.0, 37.0);fromRadians()
staticfromRadians(longitude:number,latitude:number,height?:number,ellipsoid?:Ellipsoid,result?:Cartesian3):Cartesian3
Returns a Cartesian3 position from longitude and latitude values given in radians.
参数
longitude
number
The longitude, in radians
latitude
number
The latitude, in radians
height?
number
The height, in meters, above the ellipsoid.
ellipsoid?
The ellipsoid on which the position lies.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The position
示例
ts
const position = Cesium.Cartesian3.fromRadians(-2.007, 0.645);fromDegreesArray()
staticfromDegreesArray(coordinates:number[],ellipsoid?:Ellipsoid,result?:Cartesian3[]):Cartesian3[]
Returns an array of Cartesian3 positions given an array of longitude and latitude values given in degrees.
参数
coordinates
number[]
A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
ellipsoid?
The ellipsoid on which the coordinates lie.
result?
Cartesian3[]
An array of Cartesian3 objects to store the result.
返回
Cartesian3[]
The array of positions.
示例
ts
const positions = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]);fromRadiansArray()
staticfromRadiansArray(coordinates:number[],ellipsoid?:Ellipsoid,result?:Cartesian3[]):Cartesian3[]
Returns an array of Cartesian3 positions given an array of longitude and latitude values given in radians.
参数
coordinates
number[]
A list of longitude and latitude values. Values alternate [longitude, latitude, longitude, latitude...].
ellipsoid?
The ellipsoid on which the coordinates lie.
result?
Cartesian3[]
An array of Cartesian3 objects to store the result.
返回
Cartesian3[]
The array of positions.
示例
ts
const positions = Cesium.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]);fromDegreesArrayHeights()
staticfromDegreesArrayHeights(coordinates:number[],ellipsoid?:Ellipsoid,result?:Cartesian3[]):Cartesian3[]
Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in degrees.
参数
coordinates
number[]
A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
ellipsoid?
The ellipsoid on which the position lies.
result?
Cartesian3[]
An array of Cartesian3 objects to store the result.
返回
Cartesian3[]
The array of positions.
示例
ts
const positions = Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]);fromRadiansArrayHeights()
staticfromRadiansArrayHeights(coordinates:number[],ellipsoid?:Ellipsoid,result?:Cartesian3[]):Cartesian3[]
Returns an array of Cartesian3 positions given an array of longitude, latitude and height values where longitude and latitude are given in radians.
参数
coordinates
number[]
A list of longitude, latitude and height values. Values alternate [longitude, latitude, height, longitude, latitude, height...].
ellipsoid?
The ellipsoid on which the position lies.
result?
Cartesian3[]
An array of Cartesian3 objects to store the result.
返回
Cartesian3[]
The array of positions.
示例
ts
const positions = Cesium.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]);fromCartesian4()
staticfromCartesian4(cartesian:Cartesian4,result?:Cartesian3):Cartesian3
Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the x, y, and z properties of the Cartesian4 and drops w.
参数
cartesian
The Cartesian4 instance to create a Cartesian3 instance from.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
fromArray()
staticfromArray(array:number[],startingIndex?:number,result?:Cartesian3):Cartesian3
Creates a Cartesian3 from three consecutive elements in an array.
参数
array
number[]
The array whose three consecutive elements correspond to the x, y, and z components, respectively.
startingIndex?
number
The offset into the array of the first element, which corresponds to the x component.
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
示例
ts
// Create a Cartesian3 with (1.0, 2.0, 3.0)
const v = [1.0, 2.0, 3.0];
const p = Cesium.Cartesian3.fromArray(v);
// Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
const p2 = Cesium.Cartesian3.fromArray(v2, 2);clone()
clone(
result?:Cartesian3):Cartesian3
Duplicates this Cartesian3 instance.
参数
result?
Cartesian3
The object onto which to store the result.
返回
Cartesian3
The modified result parameter or a new Cartesian3 instance if one was not provided.
equals()
equals(
right?:Cartesian3):boolean
Compares this Cartesian against the provided Cartesian componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
right?
Cartesian3
The right hand side Cartesian.
返回
boolean
true if they are equal, false otherwise.
equalsEpsilon()
equalsEpsilon(
right?:Cartesian3,relativeEpsilon?:number,absoluteEpsilon?:number):boolean
Compares this Cartesian against the provided Cartesian componentwise and returns <code>true</code> if they pass an absolute or relative tolerance test, <code>false</code> otherwise.
参数
right?
Cartesian3
The right hand side Cartesian.
relativeEpsilon?
number
The relative epsilon tolerance to use for equality testing.
absoluteEpsilon?
number
The absolute epsilon tolerance to use for equality testing.
返回
boolean
true if they are within the provided epsilon, false otherwise.
toString()
toString():
string
Creates a string representing this Cartesian in the format '(x, y, z)'.
返回
string
A string representing this Cartesian in the format '(x, y, z)'.
构造函数
构造函数
new Cartesian3(
x?:number,y?:number,z?:number):Cartesian3
参数
x?
number
y?
number
z?
number
返回
Cartesian3
