# Cartesian4

#### new Cesium.Cartesian4(x, y, z, w)
Core/Cartesian4.js 30

  A 4D Cartesian point.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `x` | Number | `0.0` | optional The X component.
  `y` | Number | `0.0` | optional The Y component.
  `z` | Number | `0.0` | optional The Z component.
  `w` | Number | `0.0` | optional The W component.

  ##### See:

  - Cartesian2
  - Cartesian3
  - Packable

### Members

#### w : Number
Core/Cartesian4.js 57

  The W component.
  Default Value: `0.0`

#### x : Number
Core/Cartesian4.js 36

  The X component.
  Default Value: `0.0`

#### y : Number
Core/Cartesian4.js 43

  The Y component.
  Default Value: `0.0`

#### z : Number
Core/Cartesian4.js 50

  The Z component.
  Default Value: `0.0`

#### staticCesium.Cartesian4.packedLength : Number
Core/Cartesian4.js 135

  The number of elements used to pack the object into an array.

#### static constantCesium.Cartesian4.UNIT_W : Cartesian4
Core/Cartesian4.js 776

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

#### static constantCesium.Cartesian4.UNIT_X : Cartesian4
Core/Cartesian4.js 752

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

#### static constantCesium.Cartesian4.UNIT_Y : Cartesian4
Core/Cartesian4.js 760

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

#### static constantCesium.Cartesian4.UNIT_Z : Cartesian4
Core/Cartesian4.js 768

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

#### static constantCesium.Cartesian4.ZERO : Cartesian4
Core/Cartesian4.js 744

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

### Methods

#### clone(result) → Cartesian4
Core/Cartesian4.js 784

  Duplicates this Cartesian4 instance.

  Name | Type | Description
  --- | --- | ---
  `result` | Cartesian4 | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was not provided.

#### equals(right) → Boolean
Core/Cartesian4.js 795

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

  Name | Type | Description
  --- | --- | ---
  `right` | Cartesian4 | optional The right hand side Cartesian.

  ##### Returns:

  `true` if they are equal, `false` otherwise.

#### equalsEpsilon(right, relativeEpsilon, absoluteEpsilon) → Boolean
Core/Cartesian4.js 809

  Compares this Cartesian against the provided Cartesian componentwise and returns `true` if they pass an absolute or relative tolerance test, `false` otherwise.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `right` | Cartesian4 |  | optional The right hand side Cartesian.
  `relativeEpsilon` | Number |  | The relative epsilon tolerance to use for equality testing.
  `absoluteEpsilon` | Number | `relativeEpsilon` | optional The absolute epsilon tolerance to use for equality testing.

  ##### Returns:

  `true` if they are within the provided epsilon, `false` otherwise.

#### toString() → String
Core/Cartesian4.js 818

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

  ##### Returns:

  A string representing the provided Cartesian in the format '(x, y)'.

#### staticCesium.Cartesian4.abs(cartesian, result) → Cartesian4
Core/Cartesian4.js 593

  Computes the absolute value of the provided Cartesian.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian whose absolute value is to be computed.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.add(left, right, result) → Cartesian4
Core/Cartesian4.js 458

  Computes the componentwise sum of two Cartesians.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first Cartesian.
  `right` | Cartesian4 | The second Cartesian.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.clone(cartesian, result) → Cartesian4
Core/Cartesian4.js 114

  Duplicates a Cartesian4 instance.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian to duplicate.
  `result` | Cartesian4 | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined)

#### staticCesium.Cartesian4.distance(left, right) → Number
Core/Cartesian4.js 340

  Computes the 4-space distance between two points.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first point to compute the distance from.
  `right` | Cartesian4 | The second point to compute the distance to.

  ##### Returns:

  The distance between two points.

  ##### Example:

      // Returns 1.0
      var d = Cesium.Cartesian4.distance(
        new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
        new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0));

#### staticCesium.Cartesian4.distanceSquared(left, right) → Number
Core/Cartesian4.js 365

  Computes the squared distance between two points. Comparing squared distances using this function is more efficient than comparing distances using `Cartesian4#distance`.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first point to compute the distance from.
  `right` | Cartesian4 | The second point to compute the distance to.

  ##### Returns:

  The distance between two points.

  ##### Example:

      // Returns 4.0, not 2.0
      var d = Cesium.Cartesian4.distance(
        new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0),
        new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0));

#### staticCesium.Cartesian4.divideByScalar(cartesian, scalar, result) → Cartesian4
Core/Cartesian4.js 542

  Divides the provided Cartesian componentwise by the provided scalar.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian to be divided.
  `scalar` | Number | The scalar to divide by.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.dot(left, right) → Number
Core/Cartesian4.js 409

  Computes the dot (scalar) product of two Cartesians.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first Cartesian.
  `right` | Cartesian4 | The second Cartesian.

  ##### Returns:

  The dot product.

#### staticCesium.Cartesian4.equals(left, right) → Boolean
Core/Cartesian4.js 697

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

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | optional The first Cartesian.
  `right` | Cartesian4 | optional The second Cartesian.

  ##### Returns:

  `true` if left and right are equal, `false` otherwise.

#### staticCesium.Cartesian4.equalsEpsilon(left, right, relativeEpsilon, absoluteEpsilon) → Boolean
Core/Cartesian4.js 728

  Compares the provided Cartesians componentwise and returns `true` if they pass an absolute or relative tolerance test, `false` otherwise.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `left` | Cartesian4 |  | optional The first Cartesian.
  `right` | Cartesian4 |  | optional The second Cartesian.
  `relativeEpsilon` | Number |  | The relative epsilon tolerance to use for equality testing.
  `absoluteEpsilon` | Number | `relativeEpsilon` | optional The absolute epsilon tolerance to use for equality testing.

  ##### Returns:

  `true` if left and right are within the provided epsilon, `false` otherwise.

#### staticCesium.Cartesian4.fromArray(array, startingIndex, result) → Cartesian4
Core/Cartesian4.js 207

  Creates a Cartesian4 from four consecutive elements in an array.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `array` | Array.<Number> |  | The array whose four consecutive elements correspond to the x, y, z, and w components, respectively.
  `startingIndex` | Number | `0` | optional The offset into the array of the first element, which corresponds to the x component.
  `result` | Cartesian4 |  | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was 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 = Cesium.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 = Cesium.Cartesian4.fromArray(v2, 2);

#### staticCesium.Cartesian4.fromColor(color, result) → Cartesian4
Core/Cartesian4.js 90

  Creates a Cartesian4 instance from a `Color`. `red`, `green`, `blue`, and `alpha` map to `x`, `y`, `z`, and `w`, respectively.

  Name | Type | Description
  --- | --- | ---
  `color` | Color | The source color.
  `result` | Cartesian4 | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was not provided.

#### staticCesium.Cartesian4.fromElements(x, y, z, w, result) → Cartesian4
Core/Cartesian4.js 70

  Creates a Cartesian4 instance from x, y, z and w coordinates.

  Name | Type | Description
  --- | --- | ---
  `x` | Number | The x coordinate.
  `y` | Number | The y coordinate.
  `z` | Number | The z coordinate.
  `w` | Number | The w coordinate.
  `result` | Cartesian4 | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was not provided.

#### staticCesium.Cartesian4.lerp(start, end, t, result) → Cartesian4
Core/Cartesian4.js 620

  Computes the linear interpolation or extrapolation at t using the provided cartesians.

  Name | Type | Description
  --- | --- | ---
  `start` | Cartesian4 | The value corresponding to t at 0.0.
  `end` | Cartesian4 | The value corresponding to t at 1.0.
  `t` | Number | The point along t at which to interpolate.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.magnitude(cartesian) → Number
Core/Cartesian4.js 321

  Computes the Cartesian's magnitude (length).

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian instance whose magnitude is to be computed.

  ##### Returns:

  The magnitude.

#### staticCesium.Cartesian4.magnitudeSquared(cartesian) → Number
Core/Cartesian4.js 305

  Computes the provided Cartesian's squared magnitude.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian instance whose squared magnitude is to be computed.

  ##### Returns:

  The squared magnitude.

#### staticCesium.Cartesian4.maximumByComponent(first, second, result) → Cartesian4
Core/Cartesian4.js 278

  Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians.

  Name | Type | Description
  --- | --- | ---
  `first` | Cartesian4 | A cartesian to compare.
  `second` | Cartesian4 | A cartesian to compare.
  `result` | Cartesian4 | The object into which to store the result.

  ##### Returns:

  A cartesian with the maximum components.

#### staticCesium.Cartesian4.maximumComponent(cartesian) → Number
Core/Cartesian4.js 215

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

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The cartesian to use.

  ##### Returns:

  The value of the maximum component.

#### staticCesium.Cartesian4.minimumByComponent(first, second, result) → Cartesian4
Core/Cartesian4.js 249

  Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians.

  Name | Type | Description
  --- | --- | ---
  `first` | Cartesian4 | A cartesian to compare.
  `second` | Cartesian4 | A cartesian to compare.
  `result` | Cartesian4 | The object into which to store the result.

  ##### Returns:

  A cartesian with the minimum components.

#### staticCesium.Cartesian4.minimumComponent(cartesian) → Number
Core/Cartesian4.js 231

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

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The cartesian to use.

  ##### Returns:

  The value of the minimum component.

#### staticCesium.Cartesian4.mostOrthogonalAxis(cartesian, result) → Cartesian4
Core/Cartesian4.js 649

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

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian on which to find the most orthogonal axis.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The most orthogonal axis.

#### staticCesium.Cartesian4.multiplyByScalar(cartesian, scalar, result) → Cartesian4
Core/Cartesian4.js 514

  Multiplies the provided Cartesian componentwise by the provided scalar.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian to be scaled.
  `scalar` | Number | The scalar to multiply with.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.multiplyComponents(left, right, result) → Cartesian4
Core/Cartesian4.js 430

  Computes the componentwise product of two Cartesians.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first Cartesian.
  `right` | Cartesian4 | The second Cartesian.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.negate(cartesian, result) → Cartesian4
Core/Cartesian4.js 569

  Negates the provided Cartesian.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian to be negated.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.normalize(cartesian, result) → Cartesian4
Core/Cartesian4.js 383

  Computes the normalized form of the supplied Cartesian.

  Name | Type | Description
  --- | --- | ---
  `cartesian` | Cartesian4 | The Cartesian to be normalized.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.pack(value, array, startingIndex)
Core/Cartesian4.js 144

  Stores the provided instance into the provided array.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `value` | Cartesian4 |  | The value to pack.
  `array` | Array.<Number> |  | The array to pack into.
  `startingIndex` | Number | `0` | optional The index into the array at which to start packing the elements.

#### staticCesium.Cartesian4.subtract(left, right, result) → Cartesian4
Core/Cartesian4.js 486

  Computes the componentwise difference of two Cartesians.

  Name | Type | Description
  --- | --- | ---
  `left` | Cartesian4 | The first Cartesian.
  `right` | Cartesian4 | The second Cartesian.
  `result` | Cartesian4 | The object onto which to store the result.

  ##### Returns:

  The modified result parameter.

#### staticCesium.Cartesian4.unpack(array, startingIndex, result) → Cartesian4
Core/Cartesian4.js 170

  Retrieves an instance from a packed array.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `array` | Array.<Number> |  | The packed array.
  `startingIndex` | Number | `0` | optional The starting index of the element to be unpacked.
  `result` | Cartesian4 |  | optional The object into which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartesian4 instance if one was not provided.