new Cartesian4
A 4D Cartesian point.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x |
Number |
<optional> |
0.0 | The X component. |
y |
Number |
<optional> |
0.0 | The Y component. |
z |
Number |
<optional> |
0.0 | The Z component. |
w |
Number |
<optional> |
0.0 | The W component. |
See:
Source:
Members
-
w :Number
-
The W component.
- Default Value:
- 0.0
-
x :Number
-
The X component.
- Default Value:
- 0.0
-
y :Number
-
The Y component.
- Default Value:
- 0.0
-
z :Number
-
The Z component.
- Default Value:
- 0.0
-
<static> fromArray
-
Creates a Cartesian4 from four consecutive elements in an array.
Example
// Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) var v = [1.0, 2.0, 3.0, 4.0]; var p = Cesium.Cartesian4.fromArray(v); // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array var v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0]; var p2 = Cesium.Cartesian4.fromArray(v2, 2);
-
<static> packedLength :Number
-
The number of elements used to pack the object into an array.
-
<static> UNIT_W
-
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
-
<static> UNIT_X
-
An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
-
<static> UNIT_Y
-
An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
-
<static> UNIT_Z
-
An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
-
<static> ZERO
-
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
Methods
-
clone
-
Duplicates this Cartesian4 instance.
Parameters:
Name Type Argument Description result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
equals
-
Compares this Cartesian against the provided Cartesian componentwise and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument Description right
Cartesian4 <optional>
The right hand side Cartesian. Returns:
Booleantrue
if they are equal,false
otherwise. -
equalsEpsilon
-
Compares this Cartesian against the provided Cartesian componentwise and returns
true
if they are within the provided epsilon,false
otherwise.Parameters:
Name Type Argument Description right
Cartesian4 <optional>
The right hand side Cartesian. epsilon
Number The epsilon to use for equality testing. Returns:
Booleantrue
if they are within the provided epsilon,false
otherwise. -
toString
-
Creates a string representing this Cartesian in the format '(x, y)'.
Returns:
String A string representing the provided Cartesian in the format '(x, y)'. -
<static> abs
-
Computes the absolute value of the provided Cartesian.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian whose absolute value is to be computed. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> add
-
Computes the componentwise sum of two Cartesians.
Parameters:
Name Type Argument Description left
Cartesian4 The first Cartesian. right
Cartesian4 The second Cartesian. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> clone
-
Duplicates a Cartesian4 instance.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian to duplicate. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined) -
<static> distance
-
Computes the 4-space distance between two points
Parameters:
Name Type Description left
Cartesian4 The first point to compute the distance from. right
Cartesian4 The second point to compute the distance to. Returns:
Number The distance between two points.Example
// Returns 1.0 var 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));
-
<static> divideByScalar
-
Divides the provided Cartesian componentwise by the provided scalar.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian to be divided. scalar
Number The scalar to divide by. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> dot
-
Computes the dot (scalar) product of two Cartesians.
Parameters:
Name Type Description left
Cartesian4 The first Cartesian. right
Cartesian4 The second Cartesian. Returns:
Number The dot product. -
<static> equals
-
Compares the provided Cartesians componentwise and returns
true
if they are equal,false
otherwise.Parameters:
Name Type Argument Description left
Cartesian4 <optional>
The first Cartesian. right
Cartesian4 <optional>
The second Cartesian. Returns:
Booleantrue
if left and right are equal,false
otherwise. -
<static> equalsEpsilon
-
Compares the provided Cartesians componentwise and returns
true
if they are within the provided epsilon,false
otherwise.Parameters:
Name Type Argument Description left
Cartesian4 <optional>
The first Cartesian. right
Cartesian4 <optional>
The second Cartesian. epsilon
Number The epsilon to use for equality testing. Returns:
Booleantrue
if left and right are within the provided epsilon,false
otherwise. -
<static> fromElements
-
Creates a Cartesian4 instance from x, y, z and w coordinates.
Parameters:
Name Type Argument Description x
Number The x coordinate. y
Number The y coordinate. z
Number The z coordinate. w
Number The w coordinate. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> getMaximumByComponent
-
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
Parameters:
Name Type Argument Description first
Cartesian4 A cartesian to compare. second
Cartesian4 A cartesian to compare. result
Cartesian4 <optional>
The object into which to store the result. Returns:
Cartesian4 A cartesian with the maximum components. -
<static> getMaximumComponent
-
Computes the value of the maximum component for the supplied Cartesian.
Parameters:
Name Type Description The
Cartesian4 cartesian to use. Returns:
Number The value of the maximum component. -
<static> getMinimumByComponent
-
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
Parameters:
Name Type Argument Description first
Cartesian4 A cartesian to compare. second
Cartesian4 A cartesian to compare. result
Cartesian4 <optional>
The object into which to store the result. Returns:
Cartesian4 A cartesian with the minimum components. -
<static> getMinimumComponent
-
Computes the value of the minimum component for the supplied Cartesian.
Parameters:
Name Type Description The
Cartesian4 cartesian to use. Returns:
Number The value of the minimum component. -
<static> lerp
-
Computes the linear interpolation or extrapolation at t using the provided cartesians.
Parameters:
Name Type Argument Description start
The value corresponding to t at 0.0. end
The value corresponding to t at 1.0. t
The point along t at which to interpolate. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> magnitude
-
Computes the Cartesian's magnitude (length).
Parameters:
Name Type Description cartesian
Cartesian4 The Cartesian instance whose magnitude is to be computed. Returns:
Number The magnitude. -
<static> magnitudeSquared
-
Computes the provided Cartesian's squared magnitude.
Parameters:
Name Type Description cartesian
Cartesian4 The Cartesian instance whose squared magnitude is to be computed. Returns:
Number The squared magnitude. -
<static> mostOrthogonalAxis
-
Returns the axis that is most orthogonal to the provided Cartesian.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian on which to find the most orthogonal axis. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The most orthogonal axis. -
<static> multiplyByScalar
-
Multiplies the provided Cartesian componentwise by the provided scalar.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian to be scaled. scalar
Number The scalar to multiply with. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> multiplyComponents
-
Computes the componentwise product of two Cartesians.
Parameters:
Name Type Argument Description left
Cartesian4 The first Cartesian. right
Cartesian4 The second Cartesian. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> negate
-
Negates the provided Cartesian.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian to be negated. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> normalize
-
Computes the normalized form of the supplied Cartesian.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The Cartesian to be normalized. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> pack
-
Stores the provided instance into the provided array.
Parameters:
Name Type Argument Default Description value
Cartesian4 The value to pack. array
Array The array to pack into. startingIndex
Number <optional>
0 The index into the array at which to start packing the elements. -
<static> subtract
-
Computes the componentwise difference of two Cartesians.
Parameters:
Name Type Argument Description left
Cartesian4 The first Cartesian. right
Cartesian4 The second Cartesian. result
Cartesian4 <optional>
The object onto which to store the result. Returns:
Cartesian4 The modified result parameter or a new Cartesian4 instance if one was not provided. -
<static> unpack
-
Retrieves an instance from a packed array.
Parameters:
Name Type Argument Default Description array
Array The packed array. startingIndex
Number <optional>
0 The starting index of the element to be unpacked. result
Cartesian4 <optional>
The object into which to store the result.