Appearance
KBE3D / KBCore / Cesium / Cartesian4
类: Cartesian4
A 4D Cartesian point.
参数
The X component.
参数
The Y component.
参数
The Z component.
参数
The W component.
属性
packedLength
staticpackedLength:number
The number of elements used to pack the object into an array.
ZERO
readonlystaticZERO:Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
ONE
readonlystaticONE:Cartesian4
An immutable Cartesian4 instance initialized to (1.0, 1.0, 1.0, 1.0).
UNIT_X
readonlystaticUNIT_X:Cartesian4
An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
UNIT_Y
readonlystaticUNIT_Y:Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
UNIT_Z
readonlystaticUNIT_Z:Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
UNIT_W
readonlystaticUNIT_W:Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
x
x:
number
The X component.
y
y:
number
The Y component.
z
z:
number
The Z component.
w
w:
number
The W component.
方法
fromElements()
staticfromElements(x:number,y:number,z:number,w:number,result?:Cartesian4):Cartesian4
Creates a Cartesian4 instance from x, y, z and w coordinates.
参数
x
number
The x coordinate.
y
number
The y coordinate.
z
number
The z coordinate.
w
number
The w coordinate.
result?
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided.
fromColor()
staticfromColor(color:Color,result?:Cartesian4):Cartesian4
Creates a Cartesian4 instance from a Color. <code>red</code>, <code>green</code>, <code>blue</code>, and <code>alpha</code> map to <code>x</code>, <code>y</code>, <code>z</code>, and <code>w</code>, respectively.
参数
color
The source color.
result?
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided.
clone()
staticclone(cartesian:Cartesian4,result?:Cartesian4):Cartesian4
Duplicates a Cartesian4 instance.
参数
cartesian
Cartesian4
The Cartesian to duplicate.
result?
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
pack()
staticpack(value:Cartesian4,array:number[] |TypedArray,startingIndex?:number):number[] |TypedArray
Stores the provided instance into the provided array.
参数
value
Cartesian4
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?:Cartesian4):Cartesian4
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?
Cartesian4
The object into which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided.
packArray()
staticpackArray(array:Cartesian4[],result?:number[] |TypedArray):number[] |TypedArray
Flattens an array of Cartesian4s into an array of components.
参数
array
Cartesian4[]
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 * 4 components, else a DeveloperError will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements.
number[] | TypedArray
返回
number[] | TypedArray
The packed array.
unpackArray()
staticunpackArray(array:number[] |TypedArray,result?:Cartesian4[]):Cartesian4[]
Unpacks an array of cartesian components into an array of Cartesian4s.
参数
array
The array of components to unpack.
number[] | TypedArray
result?
Cartesian4[]
The array onto which to store the result.
返回
Cartesian4[]
The unpacked array.
maximumComponent()
staticmaximumComponent(cartesian:Cartesian4):number
Computes the value of the maximum component for the supplied Cartesian.
参数
cartesian
Cartesian4
The cartesian to use.
返回
number
The value of the maximum component.
minimumComponent()
staticminimumComponent(cartesian:Cartesian4):number
Computes the value of the minimum component for the supplied Cartesian.
参数
cartesian
Cartesian4
The cartesian to use.
返回
number
The value of the minimum component.
minimumByComponent()
staticminimumByComponent(first:Cartesian4,second:Cartesian4,result:Cartesian4):Cartesian4
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
参数
first
Cartesian4
A cartesian to compare.
second
Cartesian4
A cartesian to compare.
result
Cartesian4
The object into which to store the result.
返回
Cartesian4
A cartesian with the minimum components.
maximumByComponent()
staticmaximumByComponent(first:Cartesian4,second:Cartesian4,result:Cartesian4):Cartesian4
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
参数
first
Cartesian4
A cartesian to compare.
second
Cartesian4
A cartesian to compare.
result
Cartesian4
The object into which to store the result.
返回
Cartesian4
A cartesian with the maximum components.
clamp()
staticclamp(value:Cartesian4,min:Cartesian4,max:Cartesian4,result:Cartesian4):Cartesian4
Constrain a value to lie between two values.
参数
value
Cartesian4
The value to clamp.
min
Cartesian4
The minimum bound.
max
Cartesian4
The maximum bound.
result
Cartesian4
The object into which to store the result.
返回
Cartesian4
The clamped value such that min <= result <= max.
magnitudeSquared()
staticmagnitudeSquared(cartesian:Cartesian4):number
Computes the provided Cartesian's squared magnitude.
参数
cartesian
Cartesian4
The Cartesian instance whose squared magnitude is to be computed.
返回
number
The squared magnitude.
magnitude()
staticmagnitude(cartesian:Cartesian4):number
Computes the Cartesian's magnitude (length).
参数
cartesian
Cartesian4
The Cartesian instance whose magnitude is to be computed.
返回
number
The magnitude.
distance()
staticdistance(left:Cartesian4,right:Cartesian4):number
Computes the 4-space distance between two points.
参数
left
Cartesian4
The first point to compute the distance from.
right
Cartesian4
The second point to compute the distance to.
返回
number
The distance between two points.
示例
ts
// Returns 1.0
const d = Cesium.Cartesian4.distance(
new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));distanceSquared()
staticdistanceSquared(left:Cartesian4,right:Cartesian4):number
Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using Cartesian4#distance.
参数
left
Cartesian4
The first point to compute the distance from.
right
Cartesian4
The second point to compute the distance to.
返回
number
The distance between two points.
示例
ts
// Returns 4.0, not 2.0
const d = Cesium.Cartesian4.distance(
new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));normalize()
staticnormalize(cartesian:Cartesian4,result:Cartesian4):Cartesian4
Computes the normalized form of the supplied Cartesian.
参数
cartesian
Cartesian4
The Cartesian to be normalized.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
dot()
staticdot(left:Cartesian4,right:Cartesian4):number
Computes the dot (scalar) product of two Cartesians.
参数
left
Cartesian4
The first Cartesian.
right
Cartesian4
The second Cartesian.
返回
number
The dot product.
multiplyComponents()
staticmultiplyComponents(left:Cartesian4,right:Cartesian4,result:Cartesian4):Cartesian4
Computes the componentwise product of two Cartesians.
参数
left
Cartesian4
The first Cartesian.
right
Cartesian4
The second Cartesian.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
divideComponents()
staticdivideComponents(left:Cartesian4,right:Cartesian4,result:Cartesian4):Cartesian4
Computes the componentwise quotient of two Cartesians.
参数
left
Cartesian4
The first Cartesian.
right
Cartesian4
The second Cartesian.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
add()
staticadd(left:Cartesian4,right:Cartesian4,result:Cartesian4):Cartesian4
Computes the componentwise sum of two Cartesians.
参数
left
Cartesian4
The first Cartesian.
right
Cartesian4
The second Cartesian.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
subtract()
staticsubtract(left:Cartesian4,right:Cartesian4,result:Cartesian4):Cartesian4
Computes the componentwise difference of two Cartesians.
参数
left
Cartesian4
The first Cartesian.
right
Cartesian4
The second Cartesian.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
multiplyByScalar()
staticmultiplyByScalar(cartesian:Cartesian4,scalar:number,result:Cartesian4):Cartesian4
Multiplies the provided Cartesian componentwise by the provided scalar.
参数
cartesian
Cartesian4
The Cartesian to be scaled.
scalar
number
The scalar to multiply with.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
divideByScalar()
staticdivideByScalar(cartesian:Cartesian4,scalar:number,result:Cartesian4):Cartesian4
Divides the provided Cartesian componentwise by the provided scalar.
参数
cartesian
Cartesian4
The Cartesian to be divided.
scalar
number
The scalar to divide by.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
negate()
staticnegate(cartesian:Cartesian4,result:Cartesian4):Cartesian4
Negates the provided Cartesian.
参数
cartesian
Cartesian4
The Cartesian to be negated.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
abs()
staticabs(cartesian:Cartesian4,result:Cartesian4):Cartesian4
Computes the absolute value of the provided Cartesian.
参数
cartesian
Cartesian4
The Cartesian whose absolute value is to be computed.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
lerp()
staticlerp(start:Cartesian4,end:Cartesian4,t:number,result:Cartesian4):Cartesian4
Computes the linear interpolation or extrapolation at t using the provided cartesians.
参数
start
Cartesian4
The value corresponding to t at 0.0.
end
Cartesian4
The value corresponding to t at 1.0.
t
number
The point along t at which to interpolate.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter.
mostOrthogonalAxis()
staticmostOrthogonalAxis(cartesian:Cartesian4,result:Cartesian4):Cartesian4
Returns the axis that is most orthogonal to the provided Cartesian.
参数
cartesian
Cartesian4
The Cartesian on which to find the most orthogonal axis.
result
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The most orthogonal axis.
equals()
staticequals(left?:Cartesian4,right?:Cartesian4):boolean
Compares the provided Cartesians componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
left?
Cartesian4
The first Cartesian.
right?
Cartesian4
The second Cartesian.
返回
boolean
true if left and right are equal, false otherwise.
equalsEpsilon()
staticequalsEpsilon(left?:Cartesian4,right?:Cartesian4,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?
Cartesian4
The first Cartesian.
right?
Cartesian4
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.
packFloat()
staticpackFloat(value:number,result?:Cartesian4):Cartesian4
Packs an arbitrary floating point value to 4 values representable using uint8.
参数
value
number
A floating point number.
result?
Cartesian4
The Cartesian4 that will contain the packed float.
返回
Cartesian4
A Cartesian4 representing the float packed to values in x, y, z, and w.
fromArray()
staticfromArray(array:number[],startingIndex?:number,result?:Cartesian4):Cartesian4
Creates a Cartesian4 from four consecutive elements in an array.
参数
array
number[]
The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
startingIndex?
number
The offset into the array of the first element, which corresponds to the x component.
result?
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided.
示例
ts
// Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0)
const v = [1.0, 2.0, 3.0, 4.0];
const p = Cesium.Cartesian4.fromArray(v);
// Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0];
const p2 = Cesium.Cartesian4.fromArray(v2, 2);clone()
clone(
result?:Cartesian4):Cartesian4
Duplicates this Cartesian4 instance.
参数
result?
Cartesian4
The object onto which to store the result.
返回
Cartesian4
The modified result parameter or a new Cartesian4 instance if one was not provided.
equals()
equals(
right?:Cartesian4):boolean
Compares this Cartesian against the provided Cartesian componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
right?
Cartesian4
The right hand side Cartesian.
返回
boolean
true if they are equal, false otherwise.
equalsEpsilon()
equalsEpsilon(
right?:Cartesian4,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?
Cartesian4
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, w)'.
返回
string
A string representing the provided Cartesian in the format '(x, y, z, w)'.
构造函数
构造函数
new Cartesian4(
x?:number,y?:number,z?:number,w?:number):Cartesian4
参数
x?
number
y?
number
z?
number
w?
number
返回
Cartesian4
