Rotation - Cesium Documentation

# Rotation

Represents a `Packable` number that always interpolates values towards the shortest angle of rotation. This object is never used directly but is instead passed to the constructor of `SampledProperty` in order to represent a two-dimensional angle of rotation.

##### Example:

    var time1 = JulianDate.fromIso8601('2010-05-07T00:00:00');
    var time2 = JulianDate.fromIso8601('2010-05-07T00:01:00');
    var time3 = JulianDate.fromIso8601('2010-05-07T00:02:00');

    var property = new SampledProperty(Rotation);
    property.addSample(time1, 0);
    property.addSample(time3, CesiumMath.toRadians(350));

    //Getting the value at time2 will equal 355 degrees instead
    //of 175 degrees (which is what you get if you construct
    //a SampledProperty(Number) instead.  Note, the actual
    //return value is in radians, not degrees.
    property.getValue(time2);

##### See:

- PackableForInterpolation

Source: DataSources/Rotation.js, line 40

### Members

#### staticRotation.packedLength :Number

  The number of elements used to pack the object into an array.
  Source: DataSources/Rotation.js, line 45

### Methods

#### staticRotation.convertPackedArrayForInterpolation(packedArray, startingIndex, lastIndex, result)

  Converts a packed array into a form suitable for interpolation.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `packedArray` | Array.<Number> |  | The packed array.
  `startingIndex` | Number | `0` | optional The index of the first element to be converted.
  `lastIndex` | Number | `packedArray.length` | optional The index of the last element to be converted.
  `result` | Array.<Number> |  | The object into which to store the result.

  Source: DataSources/Rotation.js, line 98

#### staticRotation.pack(value, array, startingIndex)

  Stores the provided instance into the provided array.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `value` | Object |  | 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.

  Source: DataSources/Rotation.js, line 55

#### staticRotation.unpack(array, startingIndex, result)

  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` | Object |  | optional The object into which to store the result.

  Source: DataSources/Rotation.js, line 78

#### staticRotation.unpackInterpolationResult(array, sourceArray, startingIndex, lastIndex, result)

  Retrieves an instance from a packed array converted with `Rotation.convertPackedArrayForInterpolation`.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `array` | Array.<Number> |  | The array previously packed for interpolation.
  `sourceArray` | Array.<Number> |  | The original packed array.
  `startingIndex` | Number | `0` | optional The startingIndex used to convert the array.
  `lastIndex` | Number | `packedArray.length` | optional The lastIndex used to convert the array.
  `result` | Object |  | optional The object into which to store the result.

  Source: DataSources/Rotation.js, line 130