Cartesian3

Cartesian3

new

A 3D 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.
See:
Source:

Members

:Number

The X component.
Default Value:
  • 0.0

:Number

The Y component.
Default Value:
  • 0.0

:Number

The Z component.
Default Value:
  • 0.0

<static>

An immutable Cartesian3 instance initialized to (1.0, 0.0, 0.0).

<static>

An immutable Cartesian3 instance initialized to (0.0, 1.0, 0.0).

<static>

An immutable Cartesian3 instance initialized to (0.0, 0.0, 1.0).

<static>

An immutable Cartesian3 instance initialized to (0.0, 0.0, 0.0).

Methods

Computes the absolute value of this Cartesian.

Parameters:
Name Type Argument Description
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the componentwise sum of this Cartesian and the provided Cartesian.

Parameters:
Name Type Argument Description
right Cartesian3 The right hand side Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : right is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Returns the angle, in radians, between this Cartesian and the provided Cartesian.

Parameters:
Name Type Description
right Cartesian3 The right hand side Cartesian.
Throws:
Returns:
Number The angle between the Cartesians.

Duplicates this Cartesian3 instance.

Parameters:
Name Type Argument Description
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the cross (outer) product of this and the provided Cartesian.

Parameters:
Name Type Argument Description
right Cartesian3 The right hand side Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : right is required.
Returns:
Cartesian3 The cross product.

Divides this Cartesian componentwise by the provided scalar.

Parameters:
Name Type Argument Description
scalar Number The scalar to divide by.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : scalar is required and must be a number.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the dot (scalar) product of this Cartesian and a supplied cartesian.

Parameters:
Name Type Description
right Cartesian3 The right hand side Cartesian.
Throws:
DeveloperError : right is required.
Returns:
Number The dot product.

Compares this Cartesian against the provided Cartesian componentwise and returns true if they are equal, false otherwise.

Parameters:
Name Type Argument Description
right Cartesian3 <optional>
The right hand side Cartesian.
Returns:
Boolean true if they are equal, false otherwise.

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 Cartesian3 <optional>
The right hand side Cartesian.
epsilon Number The epsilon to use for equality testing.
Throws:
DeveloperError : epsilon is required and must be a number.
Returns:
Boolean true if they are within the provided epsilon, false otherwise.

Computes the value of the maximum component for this Cartesian.

Returns:
Number The value of the maximum component.

Computes the value of the minimum component for this Cartesian.

Returns:
Number The value of the minimum component.

Computes the linear interpolation or extrapolation at t using this Cartesian and the provided cartesian. This cartesian is assumed to be t at 0.0.

Parameters:
Name Type Argument Description
end The value corresponding to t at 1.0.
t The point along t at which to interpolate.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes this Cartesian's magnitude (length).

Returns:
Number The magnitude.

Computes this Cartesian's squared magnitude.

Returns:
Number The squared magnitude.

Returns the axis that is most orthogonal to the this Cartesian.

Parameters:
Name Type Argument Description
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The most orthogonal axis.

Multiplies this Cartesian componentwise by the provided scalar.

Parameters:
Name Type Argument Description
scalar Number The scalar to multiply with.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : scalar is required and must be a number.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the componentwise product of this Cartesian and the provided Cartesian.

Parameters:
Name Type Argument Description
right Cartesian3 The right hand side Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : right is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Negates this Cartesian.

Parameters:
Name Type Argument Description
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the normalized form of this Cartesian.

Parameters:
Name Type Argument Description
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Computes the componentwise difference of this Cartesian and the provided Cartesian.

Parameters:
Name Type Argument Description
right Cartesian3 The right hand side Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : right is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

Creates a string representing this Cartesian in the format '(x, y, z)'.

Returns:
String A string representing this Cartesian in the format '(x, y, z)'.

<static>

Computes the absolute value of the provided Cartesian.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian whose absolute value is to be computed.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the componentwise sum of two Cartesians.

Parameters:
Name Type Argument Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Returns the angle, in radians, between the provided Cartesians.

Parameters:
Name Type Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
Throws:
Returns:
Number The angle between the Cartesians.

<static>

Duplicates a Cartesian3 instance.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian to duplicate.
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided. (Returns undefined if cartesian is undefined)

<static>

Computes the cross (outer) product of two Cartesians.

Parameters:
Name Type Argument Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The cross product.

<static>

Computes the distance between two points

Parameters:
Name Type Description
left Cartesian3 The first point to compute the distance from.
right Cartesian3 The second point to compute the distance to.
Throws:
DeveloperError : left and right are required.
Returns:
Number The distance between two points.
Example
// Returns 1.0
var d = Cartesian3.distance(new Cartesian3(1.0, 0.0, 0.0), new Cartesian3(2.0, 0.0, 0.0));

<static>

Divides the provided Cartesian componentwise by the provided scalar.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian to be divided.
scalar Number The scalar to divide by.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the dot (scalar) product of two Cartesians.

Parameters:
Name Type Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
Throws:
Returns:
Number The dot product.

<static>

Compares the provided Cartesians componentwise and returns true if they are equal, false otherwise.

Parameters:
Name Type Argument Description
left Cartesian3 <optional>
The first Cartesian.
right Cartesian3 <optional>
The second Cartesian.
Returns:
Boolean true if left and right are equal, false otherwise.

<static>

Compares the provided Cartesians componentwise and returns true if they are within the provided epsilon, false otherwise.

Parameters:
Name Type Argument Description
left Cartesian3 <optional>
The first Cartesian.
right Cartesian3 <optional>
The second Cartesian.
epsilon Number The epsilon to use for equality testing.
Throws:
DeveloperError : epsilon is required and must be a number.
Returns:
Boolean true if left and right are within the provided epsilon, false otherwise.

<static>

Creates a Cartesian3 from three consecutive elements in an array.

Parameters:
Name Type Argument Default Description
values Array The array whose three consecutive elements correspond to the x, y, and z components, respectively.
offset Number <optional>
0 The offset into the array of the first element, which corresponds to the x component.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.
Example
// Create a Cartesian3 with (1.0, 2.0, 3.0)
var v = [1.0, 2.0, 3.0];
var p = Cartesian3.fromArray(v);

// Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
var v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
var p2 = Cartesian3.fromArray(v2, 2);

<static>

Creates a Cartesian3 instance from an existing Cartesian4. This simply takes the x, y, and z properties of the Cartesian4 and drops w.

Parameters:
Name Type Argument Description
cartesian Cartesian4 The Cartesian4 instance to create a Cartesian3 instance from.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Creates a Cartesian3 instance from x, y and z coordinates.

Parameters:
Name Type Argument Description
x Number The x coordinate.
y Number The y coordinate.
z Number The z coordinate.
result Cartesian3 <optional>
The object onto which to store the result.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Converts the provided Spherical into Cartesian3 coordinates.

Parameters:
Name Type Argument Description
spherical Spherical The Spherical to be converted to Cartesian3.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : spherical is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the value of the maximum component for the supplied Cartesian.

Parameters:
Name Type Description
The Cartesian3 cartesian to use.
Throws:
DeveloperError : cartesian is required.
Returns:
Number The value of the maximum component.

<static>

Computes the value of the minimum component for the supplied Cartesian.

Parameters:
Name Type Description
The Cartesian3 cartesian to use.
Throws:
DeveloperError : cartesian is required.
Returns:
Number The value of the minimum component.

<static>

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 Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the Cartesian's magnitude (length).

Parameters:
Name Type Description
cartesian Cartesian3 The Cartesian instance whose magnitude is to be computed.
Throws:
DeveloperError : cartesian is required.
Returns:
Number The magnitude.

<static>

Computes the provided Cartesian's squared magnitude.

Parameters:
Name Type Description
cartesian Cartesian3 The Cartesian instance whose squared magnitude is to be computed.
Throws:
DeveloperError : cartesian is required.
Returns:
Number The squared magnitude.

<static>

Returns the axis that is most orthogonal to the provided Cartesian.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian on which to find the most orthogonal axis.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian3 The most orthogonal axis.

<static>

Multiplies the provided Cartesian componentwise by the provided scalar.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian to be scaled.
scalar Number The scalar to multiply with.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the componentwise product of two Cartesians.

Parameters:
Name Type Argument Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Negates the provided Cartesian.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian to be negated.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the normalized form of the supplied Cartesian.

Parameters:
Name Type Argument Description
cartesian Cartesian3 The Cartesian to be normalized.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.

<static>

Computes the componentwise difference of two Cartesians.

Parameters:
Name Type Argument Description
left Cartesian3 The first Cartesian.
right Cartesian3 The second Cartesian.
result Cartesian3 <optional>
The object onto which to store the result.
Throws:
Returns:
Cartesian3 The modified result parameter or a new Cartesian3 instance if one was not provided.