new Cartesian4(xopt, yopt, zopt, wopt)
A 4D Cartesian point.
Parameters:
Name | Type | Attributes | 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. |
- Source:
- See:
-
- Cartesian2
- Cartesian3
- Packable
Members
w :Number
The W component.
Type:
- Number
- Default Value:
- 0.0
- Source:
x :Number
The X component.
Type:
- Number
- Default Value:
- 0.0
- Source:
y :Number
The Y component.
Type:
- Number
- Default Value:
- 0.0
- Source:
z :Number
The Z component.
Type:
- Number
- Default Value:
- 0.0
- Source:
(static) packedLength :Number
The number of elements used to pack the object into an array.
Type:
- Number
- Source:
(static, constant) UNIT_W :Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
Type:
- Source:
(static, constant) UNIT_X :Cartesian4
An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0).
Type:
- Source:
(static, constant) UNIT_Y :Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0).
Type:
- Source:
(static, constant) UNIT_Z :Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0).
Type:
- Source:
(static, constant) ZERO :Cartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0).
Type:
- Source:
Methods
clone(resultopt) → {Cartesian4}
Duplicates this Cartesian4 instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
result |
Cartesian4 |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided.
- Type
- Cartesian4
equals(rightopt) → {Boolean}
Compares this Cartesian against the provided Cartesian componentwise and returns
true
if they are equal, false
otherwise.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
right |
Cartesian4 |
<optional> |
The right hand side Cartesian. |
- Source:
Returns:
true
if they are equal, false
otherwise.
- Type
- Boolean
equalsEpsilon(rightopt, relativeEpsilon, absoluteEpsilonopt) → {Boolean}
Compares this Cartesian against the provided Cartesian componentwise and returns
true
if they pass an absolute or relative tolerance test,
false
otherwise.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
right |
Cartesian4 |
<optional> |
The right hand side Cartesian. | |
relativeEpsilon |
Number | The relative epsilon tolerance to use for equality testing. | ||
absoluteEpsilon |
Number |
<optional> |
relativeEpsilon | The absolute epsilon tolerance to use for equality testing. |
- Source:
Returns:
true
if they are within the provided epsilon, false
otherwise.
- Type
- Boolean
toString() → {String}
Creates a string representing this Cartesian in the format '(x, y)'.
- Source:
Returns:
A string representing the provided Cartesian in the format '(x, y)'.
- Type
- String
(static) abs(cartesian, result) → {Cartesian4}
Computes the absolute value of the provided Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian whose absolute value is to be computed. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) add(left, right, result) → {Cartesian4}
Computes the componentwise sum of two Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
left |
Cartesian4 | The first Cartesian. |
right |
Cartesian4 | The second Cartesian. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) clone(cartesian, resultopt) → {Cartesian4}
Duplicates a Cartesian4 instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cartesian |
Cartesian4 | The Cartesian to duplicate. | |
result |
Cartesian4 |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)
- Type
- Cartesian4
(static) distance(left, right) → {Number}
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. |
- Source:
Returns:
The distance between two points.
- Type
- Number
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) distanceSquared(left, right) → {Number}
Computes the squared distance between two points. Comparing squared distances
using this function is more efficient than comparing distances using
Cartesian4#distance
.
Parameters:
Name | Type | Description |
---|---|---|
left |
Cartesian4 | The first point to compute the distance from. |
right |
Cartesian4 | The second point to compute the distance to. |
- Source:
Returns:
The distance between two points.
- Type
- Number
Example
// Returns 4.0, not 2.0
var 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));
(static) divideByScalar(cartesian, scalar, result) → {Cartesian4}
Divides the provided Cartesian componentwise by the provided scalar.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian to be divided. |
scalar |
Number | The scalar to divide by. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) dot(left, right) → {Number}
Computes the dot (scalar) product of two Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
left |
Cartesian4 | The first Cartesian. |
right |
Cartesian4 | The second Cartesian. |
- Source:
Returns:
The dot product.
- Type
- Number
(static) equals(leftopt, rightopt) → {Boolean}
Compares the provided Cartesians componentwise and returns
true
if they are equal, false
otherwise.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
left |
Cartesian4 |
<optional> |
The first Cartesian. |
right |
Cartesian4 |
<optional> |
The second Cartesian. |
- Source:
Returns:
true
if left and right are equal, false
otherwise.
- Type
- Boolean
(static) equalsEpsilon(leftopt, rightopt, relativeEpsilon, absoluteEpsilonopt) → {Boolean}
Compares the provided Cartesians componentwise and returns
true
if they pass an absolute or relative tolerance test,
false
otherwise.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
left |
Cartesian4 |
<optional> |
The first Cartesian. | |
right |
Cartesian4 |
<optional> |
The second Cartesian. | |
relativeEpsilon |
Number | The relative epsilon tolerance to use for equality testing. | ||
absoluteEpsilon |
Number |
<optional> |
relativeEpsilon | The absolute epsilon tolerance to use for equality testing. |
- Source:
Returns:
true
if left and right are within the provided epsilon, false
otherwise.
- Type
- Boolean
(static) fromArray(array, startingIndexopt, resultopt) → {Cartesian4}
Creates a Cartesian4 from four consecutive elements in an array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array.<Number> | The array whose four consecutive elements correspond to the x, y, z, and w components, respectively. | ||
startingIndex |
Number |
<optional> |
0 | The offset into the array of the first element, which corresponds to the x component. |
result |
Cartesian4 |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided.
- Type
- Cartesian4
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) fromColor(color, resultopt) → {Cartesian4}
Creates a Cartesian4 instance from a
Color
. red
, green
, blue
,
and alpha
map to x
, y
, z
, and w
, respectively.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
color |
Color | The source color. | |
result |
Cartesian4 |
<optional> |
The object onto which to store the result. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided.
- Type
- Cartesian4
(static) fromElements(x, y, z, w, resultopt) → {Cartesian4}
Creates a Cartesian4 instance from x, y, z and w coordinates.
Parameters:
Name | Type | Attributes | 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. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided.
- Type
- Cartesian4
(static) lerp(start, end, t, result) → {Cartesian4}
Computes the linear interpolation or extrapolation at t using the provided cartesians.
Parameters:
Name | Type | Description |
---|---|---|
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. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) magnitude(cartesian) → {Number}
Computes the Cartesian's magnitude (length).
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian instance whose magnitude is to be computed. |
- Source:
Returns:
The magnitude.
- Type
- Number
(static) magnitudeSquared(cartesian) → {Number}
Computes the provided Cartesian's squared magnitude.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian instance whose squared magnitude is to be computed. |
- Source:
Returns:
The squared magnitude.
- Type
- Number
(static) maximumByComponent(first, second, result) → {Cartesian4}
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
first |
Cartesian4 | A cartesian to compare. |
second |
Cartesian4 | A cartesian to compare. |
result |
Cartesian4 | The object into which to store the result. |
- Source:
Returns:
A cartesian with the maximum components.
- Type
- Cartesian4
(static) maximumComponent(cartesian) → {Number}
Computes the value of the maximum component for the supplied Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The cartesian to use. |
- Source:
Returns:
The value of the maximum component.
- Type
- Number
(static) minimumByComponent(first, second, result) → {Cartesian4}
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
first |
Cartesian4 | A cartesian to compare. |
second |
Cartesian4 | A cartesian to compare. |
result |
Cartesian4 | The object into which to store the result. |
- Source:
Returns:
A cartesian with the minimum components.
- Type
- Cartesian4
(static) minimumComponent(cartesian) → {Number}
Computes the value of the minimum component for the supplied Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The cartesian to use. |
- Source:
Returns:
The value of the minimum component.
- Type
- Number
(static) mostOrthogonalAxis(cartesian, result) → {Cartesian4}
Returns the axis that is most orthogonal to the provided Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian on which to find the most orthogonal axis. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The most orthogonal axis.
- Type
- Cartesian4
(static) multiplyByScalar(cartesian, scalar, result) → {Cartesian4}
Multiplies the provided Cartesian componentwise by the provided scalar.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian to be scaled. |
scalar |
Number | The scalar to multiply with. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) multiplyComponents(left, right, result) → {Cartesian4}
Computes the componentwise product of two Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
left |
Cartesian4 | The first Cartesian. |
right |
Cartesian4 | The second Cartesian. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) negate(cartesian, result) → {Cartesian4}
Negates the provided Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian to be negated. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) normalize(cartesian, result) → {Cartesian4}
Computes the normalized form of the supplied Cartesian.
Parameters:
Name | Type | Description |
---|---|---|
cartesian |
Cartesian4 | The Cartesian to be normalized. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) pack(value, array, startingIndexopt) → {Array.<Number>}
Stores the provided instance into the provided array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
Cartesian4 | The value to pack. | ||
array |
Array.<Number> | The array to pack into. | ||
startingIndex |
Number |
<optional> |
0 | The index into the array at which to start packing the elements. |
- Source:
Returns:
The array that was packed into
- Type
- Array.<Number>
(static) packArray(array, result) → {Array.<Number>}
Flattens an array of Cartesian4s into and array of components.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array.<Cartesian4> | The array of cartesians to pack. |
result |
Array.<Number> | The array onto which to store the result. |
- Source:
Returns:
The packed array.
- Type
- Array.<Number>
(static) subtract(left, right, result) → {Cartesian4}
Computes the componentwise difference of two Cartesians.
Parameters:
Name | Type | Description |
---|---|---|
left |
Cartesian4 | The first Cartesian. |
right |
Cartesian4 | The second Cartesian. |
result |
Cartesian4 | The object onto which to store the result. |
- Source:
Returns:
The modified result parameter.
- Type
- Cartesian4
(static) unpack(array, startingIndexopt, resultopt) → {Cartesian4}
Retrieves an instance from a packed array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array.<Number> | 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. |
- Source:
Returns:
The modified result parameter or a new Cartesian4 instance if one was not provided.
- Type
- Cartesian4
(static) unpackArray(array, result) → {Array.<Cartesian4>}
Unpacks an array of cartesian components into and array of Cartesian4s.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array.<Number> | The array of components to unpack. |
result |
Array.<Cartesian4> | The array onto which to store the result. |
- Source:
Returns:
The unpacked array.
- Type
- Array.<Cartesian4>