new Cartesian4(x, y, z, w)
Four dimensional Cartesian coordinate point class.
| Name | Type | Default | Description |
|---|---|---|---|
x |
Number | 0.0 |
optional
X component. |
y |
Number | 0.0 |
optional
Y component. |
z |
Number | 0.0 |
optional
Z component. |
w |
Number | 0.0 |
optional
W component. |
- See:
-
- Cartesian2
- Cartesian3
- Packable
Members
-
wNumber
-
W component.
- Default Value: 0.0
xNumber
X component.
- Default Value: 0.0
yNumber
Y component.
- Default Value: 0.0
zNumber
Z component.
- Default Value: 0.0
static packedLengthNumber
The number of elements used to package objects into an array.
(static, constant) UNIT_WCartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0).
(static, constant) UNIT_XCartesian4
An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0).
(static, constant) UNIT_YCartesian4
An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0).
(static, constant) UNIT_ZCartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0).
(static, constant) ZEROCartesian4
An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0).
Methods
-
clone(result){Cartesian4}
-
Copy this Cartesian instance.
Name Type Description resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 If no new Cartesian4 instance is provided for the modified result parameters, a new Cartesian4 instance will be provided. -
equals(right){Boolean}
-
Compare this Cartesian component with the provided Cartesian component, return true if they are equal, otherwise return false.
Name Type Description rightCartesian4 optional Cartesian on the right.
Returns:
Type Description Boolean If they are equal, it is true; otherwise, it is false. -
equalsEpsilon(right, relativeEpsilon, absoluteEpsilon){Boolean}
-
Compare this Cartesian component with the provided Cartesian component. If they pass the absolute or relative tolerance test, return true; otherwise, return false.
Name Type Default Description rightCartesian3 optional Cartesian on the right.
relativeEpsilonNumber Relative epsilon tolerance for equality testing.
absoluteEpsilonNumber relativeEpsilon optional Absolute epsilon tolerance for equality testing.
Returns:
Type Description Boolean If they are within the provided epsilon, it is true; otherwise, it is false. -
toString(){String}
-
Create a string representing this Cartesian coordinate in the format of '(x, y)'.
Returns:
Type Description String A string representing the provided Cartesian coordinates in the format of '(x, y)'. -
static abs(cartesian, result){Cartesian4}
-
Calculate the absolute value of the Cartesian coordinates provided.
Name Type Description cartesianCartesian4 To calculate the Cartesian coordinates of its absolute value.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static add(left, right, result){Cartesian4}
-
Calculate the sum of two Cartesian components.
Name Type Description leftCartesian4 The first Cartesian.
rightCartesian4 The second Cartesian.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static clone(cartesian, result){Cartesian4}
-
Copy Cartesian4 instance.
Name Type Description cartesianCartesian4 The Cartesian coordinates to be copied.
resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters or a new Cartesian4 instance (if not provided). (If Cartesian is undefined, return undefined) -
static distance(left, right){Number}
-
Calculate the spatial distance between two points.
Name Type Description leftCartesian4 Calculate the first point of distance.
rightCartesian4 Calculate the second point of distance.
Returns:
Type Description Number The distance between two points. Example
// Returns 1.0 var d = SuperMap3D.Cartesian4.distance( new SuperMap3D.Cartesian4(1.0, 0.0, 0.0, 0.0), new SuperMap3D.Cartesian4(2.0, 0.0, 0.0, 0.0)); -
static distanceSquared(left, right){Number}
-
Calculate the square distance between two points. Comparing the squares of distances using this function is more effective than comparing distances using Cartesian4 # distance.
Name Type Description leftCartesian4 Calculate the first point of distance
rightCartesian4 Calculate the second point of distance.
Returns:
Type Description Number The distance between two points. Example
// Returns 4.0, not 2.0 var d = SuperMap3D.Cartesian4.distance( new SuperMap3D.Cartesian4(1.0, 0.0, 0.0, 0.0), new SuperMap3D.Cartesian4(3.0, 0.0, 0.0, 0.0)); -
static divideByScalar(cartesian, scalar, result){Cartesian4}
-
Divide the provided Cartesian component by the provided scalar.
Name Type Description cartesianCartesian4 Divided Cartesian.
scalarNumber The scalar to be divided by.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static divideComponents(left, right, result){Cartesian4}
-
Calculate the component quotient of two Cartesians.
Name Type Description leftCartesian4 The first Cartesian.
rightCartesian4 The second Cartesian.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static dot(left, right){Number}
-
Calculate the scalar product of two Cartesian points.
Name Type Description leftCartesian4 The first Cartesian.
rightCartesian4 The second Cartesian.
Returns:
Type Description Number Dot product. -
static equals(left, right){Boolean}
-
Compare the provided Cartesian components, return true if they are equal, otherwise return false.
Name Type Description leftCartesian4 optional The first Cartesian.
rightCartesian4 optional The second Cartesian.
Returns:
Type Description Boolean If they are equal, it is true; otherwise, it is false. -
static equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon){Boolean}
-
Compare the provided Cartesian components and return true if they pass absolute or relative tolerance tests, otherwise return false.
Name Type Default Description leftCartesian4 optional The first Cartesian
rightCartesian4 optional The second Cartesian
relativeEpsilonNumber Relative epsilon tolerance for equality testing.
absoluteEpsilonNumber relativeEpsilon optional Absolute epsilon tolerance for equality testing.
Returns:
Type Description Boolean Within the provided epsilon, it is true; otherwise, it is false. -
static fromArray(array, startingIndex, result){Cartesian4}
-
Create Cartesian4 from four consecutive elements in an array.
Name Type Default Description arrayArray.<Number> Its four consecutive elements correspond to arrays of x, y, z, and w components, respectively.
startingIndexNumber 0 optional The offset of the first element in the array corresponds to the x-component.
resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters or a new Cartesian4 instance (if not provided). 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 = SuperMap3D.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 = SuperMap3D.Cartesian4.fromArray(v2, 2); -
static fromColor(color, result){Cartesian4}
-
Create a Cartesian4 instance from Color. Red, green, blue, and alpha are mapped to x, y, z, and w, respectively.
Name Type Description colorColor Source color.
resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters or a new Cartesian4 instance (if not provided). -
static fromElements(x, y, z, w, result){Cartesian4}
-
Create Cartesian4 instances from x, y, z, and w coordinates.
Name Type Description xNumber The x-coordinate.
yNumber Y-coordinate.
zNumber Z coordinate.
wNumber W coordinate.
resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters or a new Cartesian4 instance (if not provided). -
static lerp(start, end, t, result){Cartesian4}
-
Use the provided Cartesian algorithm to calculate linear interpolation or extrapolation at point t.
Name Type Description startCartesian4 At 0.0, it corresponds to the value of t.
endCartesian4 At 1.0, it corresponds to the value of t.
tNumber The point interpolated along t.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static magnitude(cartesian){Number}
-
Calculate the size (length) of Cartesian.
Name Type Description cartesianCartesian4 To calculate the size of a Cartesian instance.
Returns:
Type Description Number range. -
static magnitudeSquared(cartesian){Number}
-
Calculate the Cartesian squared amplitude provided.
Name Type Description cartesianCartesian4 To calculate the Cartesian instance of its square magnitude.
Returns:
Type Description Number Square amplitude. -
static maximumByComponent(first, second, result){Cartesian4}
-
Compare two Cartesians and calculate the Cartesian that contains the maximum component of the provided Cartesian.
Name Type Description firstCartesian4 The first Cartesian coordinate.
secondCartesian4 The second Cartesian coordinate.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 Cartesian coordinates with the maximum component. -
static maximumComponent(cartesian){Number}
-
Calculate the value of the maximum component of the Cartesian coordinates provided.
Name Type Description cartesianCartesian4 The Cartesian to be used.
Returns:
Type Description Number The value of the maximum component. -
static minimumByComponent(first, second, result){Cartesian4}
-
Compare two Cartesians and calculate the Cartesian that contains the minimum component of the provided Cartesian.
Name Type Description firstCartesian4 The first Cartesian.
secondCartesian4 The second Cartesian.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 Cartesian with the least component. -
static minimumComponent(cartesian){Number}
-
Calculate the value of the minimum component of the Cartesian coordinates provided.
Name Type Description cartesianCartesian4 The Cartesian to be used.
Returns:
Type Description Number The value of the minimum component. -
static mostOrthogonalAxis(cartesian, result){Cartesian4}
-
Return the axis that is most orthogonal to the provided Cartesian coordinates.
Name Type Description cartesianCartesian4 Find the Cartesian coordinates of the most orthogonal axis.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The most orthogonal axis. -
static multiplyByScalar(cartesian, scalar, result){Cartesian4}
-
Multiply the provided Cartesian component by the provided scalar.
Name Type Description cartesianCartesian4 Cartesian needs to be scaled.
scalarNumber The scalar to be multiplied with.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static multiplyComponents(left, right, result){Cartesian4}
-
Calculate the product of two Cartesian components.
Name Type Description leftCartesian4 The first Cartesian.
rightCartesian4 The second Cartesian.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static negate(cartesian, result){Cartesian4}
-
Deny the Cartesian provided.
Name Type Description cartesianCartesian4 Cartesian who needs to be denied.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static normalize(cartesian, result){Cartesian4}
-
Calculate the normalized form of the Cartesian coordinates provided.
Name Type Description cartesianCartesian4 To standardize Cartesian coordinates.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static pack(value, array, startingIndex){Array.<Number>}
-
Store the provided instance in the provided array.
Name Type Default Description valueCartesian4 The value to be packaged.
arrayArray.<Number> The array to be packaged.
startingIndexNumber 0 optional Start packaging the array index of elements.
Returns:
Type Description Array.<Number> The loaded array. -
static packArray(array, result){Array.<Number>}
-
Flatten the Cartesian4 array into a component array.
Name Type Description arrayArray.<Cartesian4> The Cartesians array to be packaged.
resultArray.<Number> The array in which to store the results.
Returns:
Type Description Array.<Number> Packaged array. -
static packFloat(value, result){Cartesian4}
-
Package a floating-point value into an object represented by 4 unsigned integers of 8-byte type
Name Type Description valueNumber A floating-point numerical point
resultCartesian4 optional If no new Cartesian4 instance is provided, use the modified result parameters.
Returns:
Type Description Cartesian4 A Cartesian4 representing the float packed to values in x, y, z, and w. -
static subtract(left, right, result){Cartesian4}
-
Calculate the component difference between two Cartesians.
Name Type Description leftCartesian4 The first Cartesian.
rightCartesian4 The second Cartesian.
resultCartesian4 The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters. -
static unpack(array, startingIndex, result){Cartesian4}
-
Retrieve instances from the packaged array.
Name Type Default Description arrayArray.<Number> Packaged array.
startingIndexNumber 0 optional The starting index of the element to be unpacked.
resultCartesian4 optional The object that stores the results.
Returns:
Type Description Cartesian4 The modified result parameters or a new Cartesian4 instance (if not provided). -
static unpackArray(array, result){Array.<Cartesian4>}
-
Unpack a set of Cartesian components into a set of Cartesian 4s.
Name Type Description arrayArray.<Number> The component array to be unpacked.
resultArray.<Cartesian4> An array for storing results.
Returns:
Type Description Array.<Cartesian4> The decompressed array.