@JsType(isNative=true, namespace="Cesium", name="Cartesian2") public class Cartesian2 extends Object implements Packable
Cartesian3
,
Cartesian4
Modifier and Type | Field and Description |
---|---|
static int |
packedLength
The number of elements used to pack the object into an array.
|
double |
x
The X component.
|
double |
y
The Y component.
|
Constructor and Description |
---|
Cartesian2()
A 2D Cartesian point.
|
Cartesian2(double x,
double y)
A 2D Cartesian point.
|
Modifier and Type | Method and Description |
---|---|
static Cartesian2 |
abs(Cartesian2 cartesian,
Cartesian2 result)
Computes the absolute value of the provided Cartesian.
|
static Cartesian2 |
add(Cartesian2 left,
Cartesian2 right,
Cartesian2 result)
Computes the componentwise sum of two Cartesians.
|
static double |
angleBetween(Cartesian2 left,
Cartesian2 right)
Returns the angle, in radians, between the provided Cartesians.
|
Cartesian2 |
clone()
Duplicates this Cartesian2 instance.
|
Cartesian2 |
clone(Cartesian2 result)
Duplicates this Cartesian2 instance.
|
static Cartesian2 |
clone(Cartesian2 cartesian,
Cartesian2 result)
Duplicates a Cartesian2 instance.
|
static double |
distance(Cartesian2 left,
Cartesian2 right)
Computes the distance between two points.
|
static double |
distanceSquared(Cartesian2 left,
Cartesian2 right)
Computes the squared distance between two points.
|
static Cartesian2 |
divideByScalar(Cartesian2 cartesian,
double scalar,
Cartesian2 result)
Divides the provided Cartesian componentwise by the provided scalar.
|
static Cartesian2 |
divideComponents(Cartesian2 left,
Cartesian2 right,
Cartesian2 result)
Computes the componentwise quotient of two Cartesians.
|
static double |
dot(Cartesian2 left,
Cartesian2 right)
Computes the dot (scalar) product of two Cartesians.
|
Cartesian2 |
equals(Cartesian2 right)
Compares this Cartesian against the provided Cartesian componentwise and returns true if they are equal, false otherwise.
|
static boolean |
equals(Cartesian2 left,
Cartesian2 right)
Compares the provided Cartesians componentwise and returns true if they are equal, false otherwise.
|
static boolean |
equalsEpsilon(Cartesian2 left,
Cartesian2 right,
double relativeEpsilon,
double absoluteEpsilon)
Compares the provided Cartesians componentwise and returns true if they pass an absolute or relative tolerance test, false otherwise.
|
boolean |
equalsEpsilon(Cartesian2 right,
double relativeEpsilon,
double absoluteEpsilon)
Compares this Cartesian against the provided Cartesian componentwise and returns true if they pass an absolute or
relative tolerance test, false otherwise.
|
static Cartesian2 |
fromArray(double[] array,
Cartesian2 result)
Creates a Cartesian2 from two consecutive elements in an array.
|
static Cartesian2 |
fromArray(double[] array,
int startingIndex,
Cartesian2 result)
Creates a Cartesian2 from two consecutive elements in an array.
|
static Cartesian2 |
fromArray(com.google.gwt.core.client.JsArrayNumber array,
Cartesian2 result)
Creates a Cartesian2 from two consecutive elements in an array.
|
static Cartesian2 |
fromArray(com.google.gwt.core.client.JsArrayNumber array,
int startingIndex,
Cartesian2 result)
Creates a Cartesian2 from two consecutive elements in an array.
|
static Cartesian2 |
fromCartesian3(Cartesian3 cartesian,
Cartesian2 result)
Creates a Cartesian2 instance from an existing Cartesian3.
|
static Cartesian2 |
fromCartesian4(Cartesian4 cartesian,
Cartesian2 result)
Creates a Cartesian2 instance from an existing Cartesian4.
|
static Cartesian2 |
fromElements(double x,
double y,
Cartesian2 result)
Creates a Cartesian2 instance from x and y coordinates.
|
static Cartesian2 |
lerp(Cartesian2 start,
Cartesian2 end,
double t,
Cartesian2 result)
Computes the linear interpolation or extrapolation at t using the provided cartesians.
|
static double |
magnitude(Cartesian2 cartesian)
Computes the Cartesian's magnitude (length).
|
static double |
magnitudeSquared(Cartesian2 cartesian)
Computes the provided Cartesian's squared magnitude.
|
static Cartesian2 |
maximumByComponent(Cartesian2 first,
Cartesian2 second,
Cartesian2 result)
Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.
|
static double |
maximumComponent(Cartesian2 cartesian)
Computes the value of the maximum component for the supplied Cartesian.
|
static Cartesian2 |
minimumByComponent(Cartesian2 first,
Cartesian2 second,
Cartesian2 result)
Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.
|
static double |
minimumComponent(Cartesian2 cartesian)
Computes the value of the minimum component for the supplied Cartesian.
|
static Cartesian2 |
mostOrthogonalAxis(Cartesian2 cartesian,
Cartesian2 result)
Returns the axis that is most orthogonal to the provided Cartesian.
|
static Cartesian2 |
multiplyByScalar(Cartesian2 cartesian,
double scalar,
Cartesian2 result)
Multiplies the provided Cartesian componentwise by the provided scalar.
|
static Cartesian2 |
multiplyComponents(Cartesian2 left,
Cartesian2 right,
Cartesian2 result)
Computes the componentwise product of two Cartesians.
|
static Cartesian2 |
negate(Cartesian2 cartesian,
Cartesian2 result)
Negates the provided Cartesian.
|
static Cartesian2 |
normalize(Cartesian2 cartesian,
Cartesian2 result)
Computes the normalized form of the supplied Cartesian.
|
static com.google.gwt.core.client.JsArrayNumber |
pack(Cartesian2 value,
com.google.gwt.core.client.JsArrayNumber array,
int startingIndex)
Stores the provided instance into the provided array.
|
static com.google.gwt.core.client.JsArrayNumber |
packArray(Cartesian2[] array,
com.google.gwt.core.client.JsArrayNumber result)
Flattens an array of Cartesian2s into and array of components.
|
static Cartesian2 |
subtract(Cartesian2 left,
Cartesian2 right,
Cartesian2 result)
Computes the componentwise difference of two Cartesians.
|
String |
toString()
Creates a string representing this Cartesian in the format '(x, y)'.
|
static Cartesian2 |
UNIT_X()
An immutable Cartesian2 instance initialized to (1.0, 0.0).
|
static Cartesian2 |
UNIT_Y()
An immutable Cartesian2 instance initialized to (0.0, 1.0).
|
static Cartesian2 |
unpack(com.google.gwt.core.client.JsArrayNumber array)
Retrieves an instance from a packed array.
|
static Cartesian2 |
unpack(com.google.gwt.core.client.JsArrayNumber array,
int startingIndex,
Cartesian2 result)
Retrieves an instance from a packed array.
|
static Cartesian2[] |
unpackArray(com.google.gwt.core.client.JsArrayNumber array,
Cartesian2[] result)
Unpacks an array of cartesian components into and array of Cartesian2s.
|
static Cartesian2 |
ZERO()
An immutable Cartesian2 instance initialized to (0.0, 0.0).
|
@JsProperty public double x
@JsProperty public double y
@JsProperty public static int packedLength
@JsConstructor public Cartesian2()
Cartesian3
,
Cartesian4
@JsConstructor public Cartesian2(double x, double y)
x
- The X component. Default Value: 0.0y
- The Y component. Default Value: 0.0Cartesian3
,
Cartesian4
@JsProperty(name="UNIT_X") public static Cartesian2 UNIT_X()
@JsProperty(name="UNIT_Y") public static Cartesian2 UNIT_Y()
@JsProperty(name="ZERO") public static Cartesian2 ZERO()
@JsMethod public Cartesian2 clone(Cartesian2 result)
result
- The object onto which to store the result. Optional.@JsMethod public Cartesian2 clone()
@JsMethod public Cartesian2 equals(Cartesian2 right)
right
- The right hand side Cartesian. Optional.@JsMethod public boolean equalsEpsilon(Cartesian2 right, double relativeEpsilon, double absoluteEpsilon)
right
- The right hand side Cartesian. Optional.relativeEpsilon
- The relative epsilon tolerance to use for equality testing.absoluteEpsilon
- The absolute epsilon tolerance to use for equality testing. Optional.@JsMethod public String toString()
@JsMethod public static Cartesian2 abs(Cartesian2 cartesian, Cartesian2 result)
cartesian
- The Cartesian whose absolute value is to be computed.result
- The object onto which to store the result.@JsMethod public static Cartesian2 add(Cartesian2 left, Cartesian2 right, Cartesian2 result)
left
- The first Cartesian.right
- The second Cartesian.result
- The object onto which to store the result.@JsMethod public static double angleBetween(Cartesian2 left, Cartesian2 right)
left
- The first Cartesian.right
- The second Cartesian.@JsMethod public static Cartesian2 clone(Cartesian2 cartesian, Cartesian2 result)
cartesian
- The Cartesian to duplicate.result
- The object onto which to store the result. Optional.@JsMethod public static double distance(Cartesian2 left, Cartesian2 right)
Example:
// Returns 1.0
double d = Cartesian2.distance(new Cartesian2(1.0, 0.0), new Cartesian2(2.0, 0.0));
left
- The first point to compute the distance from.right
- The second point to compute the distance to.@JsMethod public static double distanceSquared(Cartesian2 left, Cartesian2 right)
Example:
// Returns 4.0, not 2.0
double d = Cartesian2.distanceSquared(new Cartesian2(1.0, 0.0), new Cartesian2(3.0, 0.0));
left
- The first point to compute the distance from.right
- The second point to compute the distance to.@JsMethod public static Cartesian2 divideByScalar(Cartesian2 cartesian, double scalar, Cartesian2 result)
cartesian
- The Cartesian to be divided.scalar
- The scalar to divide by.result
- The object onto which to store the result.@JsMethod public static Cartesian2 divideComponents(Cartesian2 left, Cartesian2 right, Cartesian2 result)
left
- The first Cartesian.right
- The second Cartesian.result
- The object onto which to store the result.@JsMethod public static double dot(Cartesian2 left, Cartesian2 right)
left
- The first Cartesian.right
- The second Cartesian.@JsMethod public static boolean equals(Cartesian2 left, Cartesian2 right)
left
- The first Cartesian. Optional.right
- The second Cartesian. Optional.@JsMethod public static boolean equalsEpsilon(Cartesian2 left, Cartesian2 right, double relativeEpsilon, double absoluteEpsilon)
left
- The first Cartesian. Optional.right
- The second Cartesian. Optional.relativeEpsilon
- The relative epsilon tolerance to use for equality testing.absoluteEpsilon
- The absolute epsilon tolerance to use for equality testing. Optional.@JsMethod public static Cartesian2 fromArray(com.google.gwt.core.client.JsArrayNumber array, Cartesian2 result)
Example:
JsArrayNumber jsArrayNumber = JsArray.createArray().cast();
jsArrayNumber.push(1);
jsArrayNumber.push(2);
Cartesian2 c = Cartesian2.fromArray(jsArrayNumber, 0, null);
array
- The array whose two consecutive elements correspond to the x and y components, respectively.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromArray(double[] array, Cartesian2 result)
Example:
double[] array = {1, 2};
Cartesian2 c = Cartesian2.fromArray(array, 0, null);
array
- The array whose two consecutive elements correspond to the x and y components, respectively.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromArray(com.google.gwt.core.client.JsArrayNumber array, int startingIndex, Cartesian2 result)
Example:
JsArrayNumber jsArrayNumber = JsArray.createArray().cast();
jsArrayNumber.push(1);
jsArrayNumber.push(2);
jsArrayNumber.push(3);
jsArrayNumber.push(4);
Cartesian2 c = Cartesian2.fromArray(jsArrayNumber, 2, null);
array
- The array whose two consecutive elements correspond to the x and y components, respectively.startingIndex
- The offset into the array of the first element, which corresponds to the x component. Optional.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromArray(double[] array, int startingIndex, Cartesian2 result)
Example:
double[] array = {1, 2, 3, 4};
Cartesian2 c = Cartesian2.fromArray(array, 2, null);
array
- The array whose two consecutive elements correspond to the x and y components, respectively.startingIndex
- The offset into the array of the first element, which corresponds to the x component. Optional.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromCartesian3(Cartesian3 cartesian, Cartesian2 result)
cartesian
- The Cartesian3 instance to create a Cartesian2 instance from.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromCartesian4(Cartesian4 cartesian, Cartesian2 result)
cartesian
- The Cartesian4 instance to create a Cartesian2 instance from.result
- The object onto which to store the result. Optional.@JsMethod public static Cartesian2 fromElements(double x, double y, Cartesian2 result)
x
- The x coordinate.y
- The y coordinate.result
- Cartesian2 optional The object onto which to store the result.@JsMethod public static Cartesian2 lerp(Cartesian2 start, Cartesian2 end, double t, Cartesian2 result)
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
- The object onto which to store the result.@JsMethod public static double magnitude(Cartesian2 cartesian)
cartesian
- The Cartesian instance whose magnitude is to be computed.@JsMethod public static double magnitudeSquared(Cartesian2 cartesian)
cartesian
- The Cartesian instance whose squared magnitude is to be computed.@JsMethod public static Cartesian2 maximumByComponent(Cartesian2 first, Cartesian2 second, Cartesian2 result)
first
- A cartesian to compare.second
- A cartesian to compare.result
- The object into which to store the result.@JsMethod public static double maximumComponent(Cartesian2 cartesian)
cartesian
- The cartesian to use.@JsMethod public static Cartesian2 minimumByComponent(Cartesian2 first, Cartesian2 second, Cartesian2 result)
first
- A cartesian to compare.second
- A cartesian to compare.result
- The object into which to store the result.@JsMethod public static double minimumComponent(Cartesian2 cartesian)
cartesian
- The cartesian to use.@JsMethod public static Cartesian2 mostOrthogonalAxis(Cartesian2 cartesian, Cartesian2 result)
cartesian
- The Cartesian on which to find the most orthogonal axis.result
- The object onto which to store the result.@JsMethod public static Cartesian2 multiplyByScalar(Cartesian2 cartesian, double scalar, Cartesian2 result)
cartesian
- The Cartesian to be scaled.scalar
- The scalar to multiply with.result
- The object onto which to store the result.@JsMethod public static Cartesian2 multiplyComponents(Cartesian2 left, Cartesian2 right, Cartesian2 result)
left
- The first Cartesian.right
- The second Cartesian.result
- The object onto which to store the result.@JsMethod public static Cartesian2 negate(Cartesian2 cartesian, Cartesian2 result)
cartesian
- The Cartesian to be negated.result
- The object onto which to store the result.@JsMethod public static Cartesian2 normalize(Cartesian2 cartesian, Cartesian2 result)
cartesian
- The Cartesian to be normalized.result
- The object onto which to store the result.@JsMethod public static com.google.gwt.core.client.JsArrayNumber pack(Cartesian2 value, com.google.gwt.core.client.JsArrayNumber array, int startingIndex)
value
- The value to pack.array
- The array to pack into.startingIndex
- The index into the array at which to start packing the elements. Optional.@JsMethod public static com.google.gwt.core.client.JsArrayNumber packArray(Cartesian2[] array, com.google.gwt.core.client.JsArrayNumber result)
array
- The array of cartesians to pack.result
- The array onto which to store the result.@JsMethod public static Cartesian2 subtract(Cartesian2 left, Cartesian2 right, Cartesian2 result)
left
- The first Cartesian.right
- The second Cartesian.result
- The object onto which to store the result.@JsMethod public static Cartesian2 unpack(com.google.gwt.core.client.JsArrayNumber array)
array
- The packed array.@JsMethod public static Cartesian2 unpack(com.google.gwt.core.client.JsArrayNumber array, int startingIndex, Cartesian2 result)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked. Optional. Default 0.result
- The object into which to store the result. Optional.@JsMethod public static Cartesian2[] unpackArray(com.google.gwt.core.client.JsArrayNumber array, Cartesian2[] result)
array
- The array of components to unpack.result
- The array onto which to store the result.Copyright © 2019. All rights reserved.