new Cartesian2(x, y)
A 2D Cartesian point.
| Name | Type | Default | Description |
|---|---|---|---|
x |
Number |
0.0
|
optional The X component. |
y |
Number |
0.0
|
optional The Y component. |
See:
Source:
Core/Cartesian2.js, line 26
Members
-
x :Number
-
The Y component.
-
Default Value:
0.0Source: Core/Cartesian2.js, line 32 -
y :Number
-
The X component.
-
Default Value:
0.0Source: Core/Cartesian2.js, line 39 -
staticCartesian2.fromArray
-
Creates a Cartesian2 from two consecutive elements in an array.
Example:
// Create a Cartesian2 with (1.0, 2.0) var v = [1.0, 2.0]; var p = Cesium.Cartesian2.fromArray(v); // Create a Cartesian2 with (1.0, 2.0) using an offset into an array var v2 = [0.0, 0.0, 1.0, 2.0]; var p2 = Cesium.Cartesian2.fromArray(v2, 2);Source: Core/Cartesian2.js, line 181 -
staticCartesian2.packedLength :Number
-
The number of elements used to pack the object into an array.Source: Core/Cartesian2.js, line 110
-
staticCartesian2.UNIT_X
-
An immutable Cartesian2 instance initialized to (1.0, 0.0).Source: Core/Cartesian2.js, line 688
-
staticCartesian2.UNIT_Y
-
An immutable Cartesian2 instance initialized to (0.0, 1.0).Source: Core/Cartesian2.js, line 694
-
staticCartesian2.ZERO
-
An immutable Cartesian2 instance initialized to (0.0, 0.0).Source: Core/Cartesian2.js, line 682
Methods
-
clone(result) → Cartesian2
-
Duplicates this Cartesian2 instance.
Name Type Description resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 703 -
equals(right) → Boolean
-
Compares this Cartesian against the provided Cartesian componentwise and returns
trueif they are equal,falseotherwise.Name Type Description rightCartesian2 optional The right hand side Cartesian. Returns:
trueif they are equal,falseotherwise.Source: Core/Cartesian2.js, line 715 -
equalsEpsilon(right, epsilon) → Boolean
-
Compares this Cartesian against the provided Cartesian componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description rightCartesian2 optional The right hand side Cartesian. epsilonNumber The epsilon to use for equality testing. Returns:
trueif they are within the provided epsilon,falseotherwise.Source: Core/Cartesian2.js, line 729 -
toString() → String
-
Creates a string representing this Cartesian in the format '(x, y)'.
Returns:
A string representing the provided Cartesian in the format '(x, y)'.Source: Core/Cartesian2.js, line 739 -
staticCartesian2.abs(cartesian, result) → Cartesian2
-
Computes the absolute value of the provided Cartesian.
Name Type Description cartesianCartesian2 The Cartesian whose absolute value is to be computed. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 539 -
staticCartesian2.add(left, right, result) → Cartesian2
-
Computes the componentwise sum of two Cartesians.
Name Type Description leftCartesian2 The first Cartesian. rightCartesian2 The second Cartesian. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 409 -
staticCartesian2.angleBetween(left, right) → Number
-
Returns the angle, in radians, between the provided Cartesians.
Name Type Description leftCartesian2 The first Cartesian. rightCartesian2 The second Cartesian. Returns:
The angle between the Cartesians.Source: Core/Cartesian2.js, line 593 -
staticCartesian2.clone(cartesian, result) → Cartesian2
-
Duplicates a Cartesian2 instance.
Name Type Description cartesianCartesian2 The Cartesian to duplicate. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided. (Returns undefined if cartesian is undefined)Source: Core/Cartesian2.js, line 69 -
staticCartesian2.distance(left, right) → Number
-
Computes the distance between two points
Name Type Description leftCartesian2 The first point to compute the distance from. rightCartesian2 The second point to compute the distance to. Returns:
The distance between two points.Example:
// Returns 1.0 var d = Cesium.Cartesian2.distance(new Cesium.Cartesian2(1.0, 0.0), new Cesium.Cartesian2(2.0, 0.0));Source: Core/Cartesian2.js, line 317 -
staticCartesian2.divideByScalar(cartesian, scalar, result) → Cartesian2
-
Divides the provided Cartesian componentwise by the provided scalar.
Name Type Description cartesianCartesian2 The Cartesian to be divided. scalarNumber The scalar to divide by. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 490 -
staticCartesian2.dot(left, right) → Number
-
Computes the dot (scalar) product of two Cartesians.
Name Type Description leftCartesian2 The first Cartesian. rightCartesian2 The second Cartesian. Returns:
The dot product.Source: Core/Cartesian2.js, line 360 -
staticCartesian2.equals(left, right) → Boolean
-
Compares the provided Cartesians componentwise and returns
trueif they are equal,falseotherwise.Name Type Description leftCartesian2 optional The first Cartesian. rightCartesian2 optional The second Cartesian. Returns:
trueif left and right are equal,falseotherwise.Source: Core/Cartesian2.js, line 645 -
staticCartesian2.equalsEpsilon(left, right, epsilon) → Boolean
-
Compares the provided Cartesians componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description leftCartesian2 optional The first Cartesian. rightCartesian2 optional The second Cartesian. epsilonNumber The epsilon to use for equality testing. Returns:
trueif left and right are within the provided epsilon,falseotherwise.Source: Core/Cartesian2.js, line 664 -
staticCartesian2.fromCartesian3(cartesian, result) → Cartesian2
-
Creates a Cartesian2 instance from an existing Cartesian3. This simply takes the x and y properties of the Cartesian3 and drops z.
Name Type Description cartesianCartesian3 The Cartesian3 instance to create a Cartesian2 instance from. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 93 -
staticCartesian2.fromCartesian4(cartesian, result) → Cartesian2
-
Creates a Cartesian2 instance from an existing Cartesian4. This simply takes the x and y properties of the Cartesian4 and drops z and w.
Name Type Description cartesianCartesian4 The Cartesian4 instance to create a Cartesian2 instance from. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 104 -
staticCartesian2.fromElements(x, y, result) → Cartesian2
-
Creates a Cartesian2 instance from x and y coordinates.
Name Type Description xNumber The x coordinate. yNumber The y coordinate. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 51 -
staticCartesian2.getMaximumByComponent(first, second, result) → Cartesian2
-
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
Name Type Description firstCartesian2 A cartesian to compare. secondCartesian2 A cartesian to compare. resultCartesian2 optional The object into which to store the result. Returns:
A cartesian with the maximum components.Source: Core/Cartesian2.js, line 255 -
staticCartesian2.getMaximumComponent(cartesian) → Number
-
Computes the value of the maximum component for the supplied Cartesian.
Name Type Description cartesianCartesian2 The cartesian to use. Returns:
The value of the maximum component.Source: Core/Cartesian2.js, line 190 -
staticCartesian2.getMinimumByComponent(first, second, result) → Cartesian2
-
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
Name Type Description firstCartesian2 A cartesian to compare. secondCartesian2 A cartesian to compare. resultCartesian2 optional The object into which to store the result. Returns:
A cartesian with the minimum components.Source: Core/Cartesian2.js, line 226 -
staticCartesian2.getMinimumComponent(cartesian) → Number
-
Computes the value of the minimum component for the supplied Cartesian.
Name Type Description cartesianCartesian2 The cartesian to use. Returns:
The value of the minimum component.Source: Core/Cartesian2.js, line 207 -
staticCartesian2.lerp(start, end, t, result) → Cartesian2
-
Computes the linear interpolation or extrapolation at t using the provided cartesians.
Name Type Description startCartesian2 The value corresponding to t at 0.0. endCartesian2 The value corresponding to t at 1.0. tNumber The point along t at which to interpolate. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 565 -
staticCartesian2.magnitude(cartesian) → Number
-
Computes the Cartesian's magnitude (length).
Name Type Description cartesianCartesian2 The Cartesian instance whose magnitude is to be computed. Returns:
The magnitude.Source: Core/Cartesian2.js, line 298 -
staticCartesian2.magnitudeSquared(cartesian) → Number
-
Computes the provided Cartesian's squared magnitude.
Name Type Description cartesianCartesian2 The Cartesian instance whose squared magnitude is to be computed. Returns:
The squared magnitude.Source: Core/Cartesian2.js, line 281 -
staticCartesian2.mostOrthogonalAxis(cartesian, result) → Cartesian2
-
Returns the axis that is most orthogonal to the provided Cartesian.
Name Type Description cartesianCartesian2 The Cartesian on which to find the most orthogonal axis. resultCartesian2 optional The object onto which to store the result. Returns:
The most orthogonal axis.Source: Core/Cartesian2.js, line 617 -
staticCartesian2.multiplyByScalar(cartesian, scalar, result) → Cartesian2
-
Multiplies the provided Cartesian componentwise by the provided scalar.
Name Type Description cartesianCartesian2 The Cartesian to be scaled. scalarNumber The scalar to multiply with. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 463 -
staticCartesian2.multiplyComponents(left, right, result) → Cartesian2
-
Computes the componentwise product of two Cartesians.
Name Type Description leftCartesian2 The first Cartesian. rightCartesian2 The second Cartesian. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 382 -
staticCartesian2.negate(cartesian, result) → Cartesian2
-
Negates the provided Cartesian.
Name Type Description cartesianCartesian2 The Cartesian to be negated. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 516 -
staticCartesian2.normalize(cartesian, result) → Cartesian2
-
Computes the normalized form of the supplied Cartesian.
Name Type Description cartesianCartesian2 The Cartesian to be normalized. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 336 -
staticCartesian2.pack(value, array, startingIndex)
-
Stores the provided instance into the provided array.
Name Type Default Description valueCartesian2 The value to pack. arrayNumber[] The array to pack into. startingIndexNumber 0optional The index into the array at which to start packing the elements. Source: Core/Cartesian2.js, line 120 -
staticCartesian2.subtract(left, right, result) → Cartesian2
-
Computes the componentwise difference of two Cartesians.
Name Type Description leftCartesian2 The first Cartesian. rightCartesian2 The second Cartesian. resultCartesian2 optional The object onto which to store the result. Returns:
The modified result parameter or a new Cartesian2 instance if one was not provided.Source: Core/Cartesian2.js, line 436 -
staticCartesian2.unpack(array, startingIndex, result)
-
Retrieves an instance from a packed array.
Name Type Default Description arrayNumber[] The packed array. startingIndexNumber 0optional The starting index of the element to be unpacked. resultCartesian2 optional The object into which to store the result. Source: Core/Cartesian2.js, line 145
