new Cartesian3(x, y, z)
Three 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. |
- See:
-
- Cartesian2
- Cartesian4
- Packable
Members
-
xNumber
-
X component.
- Default Value: 0.0
yNumber
Y component.
- Default Value: 0.0
zNumber
Z component.
- Default Value: 0.0
(static, constant) ONECartesian3
An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
static packedLengthNumber
The number of elements used to package objects into an array.
(static, constant) UNIT_XCartesian3
An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).
(static, constant) UNIT_XYZCartesian3
An immutable Cartesian3 instance initialized to (1.0, 1.0, 1.0).
(static, constant) UNIT_YCartesian3
An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).
(static, constant) UNIT_ZCartesian3
An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).
(static, constant) ZEROCartesian3
An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).
Methods
-
clone(result){Cartesian3}
-
Copy this Cartesian3 instance.
Name Type Description resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters or a new Cartesian3 instance (if not 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 rightCartesian3 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()
-
Convert Cartesian coordinates to string format (x, y, z).
-
static abs(cartesian, result){Cartesian3}
-
Calculate the absolute value of the Cartesian coordinates provided.
Name Type Description cartesianCartesian3 To calculate the Cartesian coordinates of its absolute value.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static add(left, right, result){Cartesian3}
-
Calculate the sum of two Cartesian components.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static angleBetween(left, right){Number}
-
Return the angle (in radians) between the provided Cartesians.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
Returns:
Type Description Number The perspective between Cartesians. -
static clone(cartesian, result){Cartesian3}
-
Copy an instance of Cartesian3.
Name Type Description cartesianCartesian3 Object to be copied.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If the modified result parameters are not provided, return a new Cartesian3 instance. If the carton is undefined, return undefined. -
static cross(left, right, result){Cartesian3}
-
Calculate the cross product of two Cartesian coordinate systems.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 Cross product. -
static distance(left, right){Number}
-
Calculate the distance between two points.
Name Type Description leftCartesian3 The first point used to calculate distance.
rightCartesian3 The second point used for calculating distance.
Returns:
Type Description Number The distance value between two points. Example
// Calculate the distance between two points and return 1.0. var d = SuperMap3D.Cartesian3.distance(new SuperMap3D.Cartesian3(1.0, 0.0, 0.0), new SuperMap3D.Cartesian3(2.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 Cartesian3 # distance.
Name Type Description leftCartesian3 Calculate the first point of distance.
rightCartesian3 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.Cartesian3.distanceSquared(new SuperMap3D.Cartesian3(1.0, 0.0, 0.0), new SuperMap3D.Cartesian3(3.0, 0.0, 0.0)); -
static divideByScalar(cartesian, scalar, result){Cartesian3}
-
Divide the provided Cartesian component by the provided scalar.
Name Type Description cartesianCartesian3 Divided Cartesian.
scalarNumber The scalar to be divided by.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static divideComponents(left, right, result){Cartesian3}
-
Calculate the component quotient of two Cartesians.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static dot(left, right){Number}
-
Calculate the dot (scalar) product of two Cartesians.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 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 leftCartesian3 optional The first Cartesian.
rightCartesian3 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 leftCartesian3 optional The first Cartesian.
rightCartesian3 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){Cartesian3}
-
Create a Cartesian3 instance based on the three consecutive elements of the array.
Name Type Default Description arrayArray.<Number> Array object, where three consecutive elements in the array correspond to x, y, and z components respectively.
startingIndexNumber 0 optional The offset of the first element in the array, which is the x-component corresponding to the "startingIndex+1" th element of the array.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If the modified result parameters are not provided, return a new Cartesian3 instance. Example
// Create a Cartesian3 instance (1.0, 2.0, 3.0). var v = [1.0, 2.0, 3.0]; var p = SuperMap3D.Cartesian3.fromArray(v); // Create a Cartesian3 instance (1.0, 2.0, 3.0). If an offset of 2 is specified, the third data corresponds to the x component. var v2 = [0.0, 0.0, 1.0, 2.0, 3.0]; var p2 = SuperMap3D.Cartesian3.fromArray(v2, 2); -
static fromCartesian4(cartesian, result){Cartesian3}
-
Create a Cartesian3 instance based on the known Cartesian4. Retain the x, y, and z components of Cartesian4 and discard the w component.
Name Type Description cartesianCartesian4 Cartesian4 object used to create Cartesian3 instances.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If the modified result parameters are not provided, return a new Cartesian3 instance. -
static fromDegrees(longitude, latitude, height, ellipsoid, result){Cartesian3}
-
Convert longitude and latitude values in degrees to Cartesian coordinates.
Name Type Default Description longitudeNumber The longitude value measured in degrees.
latitudeNumber The latitude value measured in degrees.
heightNumber 0.0 optional The height of an ellipsoid measured in meters.
ellipsoidEllipsoid Ellipsoid.WGS84 optional Ellipsoid body.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 The converted position coordinates. Example
var position = SuperMap3D.Cartesian3.fromDegrees(-115.0, 37.0); -
static fromDegreesArray(coordinates, ellipsoid, result){Array.<Cartesian3>}
-
Given an array of longitude and latitude values in degrees, return a Cartesian position array.
Name Type Default Description coordinatesArray.<Number> A list of longitude and latitude values. Value alternation [longitude, latitude, longitude, latitude...].
ellipsoidEllipsoid Ellipsoid.WGS84 optional The ellipsoid where the coordinates are located.
resultArray.<Cartesian3> optional The Cartesian3 object array to store the results.
Returns:
Type Description Array.<Cartesian3> Position array. Example
var positions = SuperMap3D.Cartesian3.fromDegreesArray([-115.0, 37.0, -107.0, 33.0]); -
static fromDegreesArrayHeights(coordinates, ellipsoid, result){Array.<Cartesian3>}
-
Given an array of longitude, latitude, and altitude values, where longitude and latitude are measured in degrees, return a Cartesian position array.
Name Type Default Description coordinatesArray.<Number> A list of longitude, latitude, and altitude values. Value alternation [longitude, latitude, altitude, longitude, latitude, altitude...].
ellipsoidEllipsoid Ellipsoid.WGS84 optional The ellipsoid where the position is located.
resultArray.<Cartesian3> optional The Cartesian3 object array to store the results.
Returns:
Type Description Array.<Cartesian3> Position array. Example
var positions = SuperMap3D.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0, -107.0, 33.0, 150000.0]); -
static fromElements(x, y, z, result){Cartesian3}
-
Create Cartesian3 instances based on x, y, and z coordinates.
Name Type Description xNumber The x-coordinate.
yNumber Y-coordinate.
zNumber Z coordinate.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If the modified result parameters are not provided, return a new Cartesian3 instance. -
static fromRadians(longitude, latitude, height, ellipsoid, result){Cartesian3}
-
Convert longitude and latitude values in radians to Cartesian coordinates.
Name Type Default Description longitudeNumber The longitude value measured in radians.
latitudeNumber The latitude value measured in radians.
heightNumber 0.0 optional The height of an ellipsoid measured in meters.
ellipsoidEllipsoid Ellipsoid.WGS84 optional Ellipsoid body.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 The converted position coordinates. Example
var position = SuperMap3D.Cartesian3.fromRadians(-2.007, 0.645); -
static fromRadiansArray(coordinates, ellipsoid, result){Array.<Cartesian3>}
-
Given an array of longitude and latitude values in radians, return a Cartesian 3 position array.
Name Type Default Description coordinatesArray.<Number> A list of longitude and latitude values. Value alternation [longitude, latitude, longitude, latitude...].
ellipsoidEllipsoid Ellipsoid.WGS84 optional The ellipsoid where the coordinates are located.
resultArray.<Cartesian3> optional The Cartesian3 object array to store the results.
Returns:
Type Description Array.<Cartesian3> Position array. Example
var positions = SuperMap3D.Cartesian3.fromRadiansArray([-2.007, 0.645, -1.867, .575]); -
static fromRadiansArrayHeights(coordinates, ellipsoid, result){Array.<Cartesian3>}
-
Return a Cartesian position array of the given longitude, latitude, and altitude values, where longitude and latitude are measured in radians.
Name Type Default Description coordinatesArray.<Number> A list of longitude, latitude, and altitude values. Value alternation [longitude, latitude, altitude, longitude, latitude, altitude...].
ellipsoidEllipsoid Ellipsoid.WGS84 optional The ellipsoid where the position is located.
resultArray.<Cartesian3> optional The Cartesian3 object array to store the results.
Returns:
Type Description Array.<Cartesian3> Position array. Example
var positions = SuperMap3D.Cartesian3.fromRadiansArrayHeights([-2.007, 0.645, 100000.0, -1.867, .575, 150000.0]); -
static fromSpherical(spherical, result){Cartesian3}
-
Convert spherical coordinates to Cartesian coordinates.
Name Type Description sphericalSpherical The spherical coordinates to be converted.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If the modified result parameters are not provided, return a new Cartesian3 instance. -
static lerp(start, end, t, result){Cartesian3}
-
Use the provided Cartesian algorithm to calculate linear interpolation or extrapolation at point t.
Name Type Description startCartesian3 At 0.0, it corresponds to the value of t.
endCartesian3 At 1.0, it corresponds to the value of t.
tNumber The point interpolated along t.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static magnitude(cartesian){Number}
-
Calculate the size (length) of Cartesian.
Name Type Description cartesianCartesian3 To calculate the size of a Cartesian instance.
Returns:
Type Description Number range. -
static magnitudeSquared(cartesian){Number}
-
Calculate the provided Cartesian squared amplitude.
Name Type Description cartesianCartesian3 To calculate the Cartesian instance of its square magnitude.
Returns:
Type Description Number Square amplitude. -
static maximumByComponent(first, second, result){Cartesian3}
-
Compare two Cartesians and calculate the Cartesian that contains the maximum component of the provided Cartesian.
Name Type Description firstCartesian3 The first Cartesian coordinate.
secondCartesian3 The second Cartesian coordinate.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 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 cartesianCartesian3 The Cartesian to be used.
Returns:
Type Description Number The value of the maximum component. -
static midpoint(left, right, result){Cartesian3}
-
Calculate the midpoint between two given Cartesian coordinate parameters
Name Type Description leftCartesian3 The first Cartesian coordinate value.
rightCartesian3 The second Cartesian coordinate value.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 Middle point. -
static minimumByComponent(first, second, result){Cartesian3}
-
Compare two Cartesians and calculate the Cartesian that contains the minimum component of the provided Cartesian.
Name Type Description firstCartesian3 The first Cartesian.
secondCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 Cartesian with the least component. -
static minimumComponent(cartesian){Number}
-
Calculate the value of the minimum component of the Cartesian coordinates provided.
Name Type Description cartesianCartesian3 The Cartesian to be used.
Returns:
Type Description Number The value of the minimum component. -
static mostOrthogonalAxis(cartesian, result){Cartesian3}
-
Return the axis that is most orthogonal to the provided Cartesian coordinates.
Name Type Description cartesianCartesian3 Find the Cartesian coordinates of the most orthogonal axis.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The most orthogonal axis. -
static multiplyByScalar(cartesian, scalar, result){Cartesian3}
-
Multiply the provided Cartesian component by the provided scalar.
Name Type Description cartesianCartesian3 Cartesian needs to be scaled.
scalarNumber The scalar to be multiplied with.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static multiplyComponents(left, right, result){Cartesian3}
-
Calculate the product of two Cartesian components.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static negate(cartesian, result){Cartesian3}
-
Deny the Cartesian provided.
Name Type Description cartesianCartesian3 Cartesian who needs to be denied.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static normalize(cartesian, result){Cartesian3}
-
Calculate the normalized form of the Cartesian coordinates provided.
Name Type Description cartesianCartesian3 To standardize Cartesian coordinates.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static pack(value, array, startingIndex){Array.<Number>}
-
Store the provided instance in the provided array.
Name Type Default Description valueCartesian3 The value to be packaged.
arrayArray.<Number> The array to be loaded.
startingIndexNumber 0 optional Start packaging the index of the array of elements.
Returns:
Type Description Array.<Number> The array that has been loaded. -
static packArray(array, result){Array.<Number>}
-
Flatten the Cartesian3 array into a component array.
Name Type Description arrayArray.<Cartesian3> The Cartesians array to be packaged.
resultArray.<Number> An array for storing results.
Returns:
Type Description Array.<Number> Packaged array. -
static subtract(left, right, result){Cartesian3}
-
Calculate the component difference between two Cartesians.
Name Type Description leftCartesian3 The first Cartesian.
rightCartesian3 The second Cartesian.
resultCartesian3 The object that stores the results.
Returns:
Type Description Cartesian3 The modified result parameters. -
static unpack(array, startingIndex, result){Cartesian3}
-
Retrieve instances from the packaged array.
Name Type Default Description arrayArray.<Number> Package the array.
startingIndexNumber 0 optional The starting index of the element to be decompressed.
resultCartesian3 optional The object that stores the results.
Returns:
Type Description Cartesian3 If no new Cartesian3 instance is provided, use the modified result parameters. -
static unpackArray(array, result){Array.<Cartesian3>}
-
Decompress a set of Cartesian components into a set of Cartesian 3s.
Name Type Description arrayArray.<Number> The component array to be unpacked.
resultArray.<Cartesian3> An array for storing results.
Returns:
Type Description Array.<Cartesian3> The decompressed array.