SampledProperty

SampledProperty

new

A Property whose value is interpolated for a given time from the provided set of samples and specified interpolation algorithm and degree.

Parameters:
Name Type Description
type Object The type of property, which must be Number, String or implement Packable.
Throws:
DeveloperError : type is required.
Examples
//Create a linearly interpolated Cartesian2
var property = new SampledProperty(Cartesian2);
property.interpolationDegree = 1;
property.interpolationAlgorithm = LinearApproximation;

//Populate it with data
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:00.00Z`), new Cartesian2(0, 0));
property.addSample(JulianDate.fromIso8601(`2012-08-02T00:00:00.00Z`), new Cartesian2(4, 7));

//Retrieve an interpolated value
var result = property.getValue(JulianDate.fromIso8601(`2012-08-01T12:00:00.00Z`));
//Create a simple numeric SampledProperty that uses third degree Hermite Polynomial Approximation
var property = new SampledProperty(Number);
property.interpolationDegree = 3;
property.interpolationAlgorithm = HermitePolynomialApproximation;

//Populate it with data
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:00.00Z`), 1.0);
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:01:00.00Z`), 6.0);
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:02:00.00Z`), 12.0);
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:03:30.00Z`), 5.0);
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:06:30.00Z`), 2.0);

//Samples can be added in any order.
property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:30.00Z`), 6.2);

//Retrieve an interpolated value
var result = property.getValue(JulianDate.fromIso8601(`2012-08-01T00:02:34.00Z`));
See:
Source:

Members

:InterpolationAlgorithm

Gets or sets the interpolation algorithm to use when retrieving a value.
Default Value:
  • LinearApproximation

:Object

Gets or sets the degree of interpolation to perform when retrieving a value.
Default Value:
  • 1

:Object

Gets the type of property.

Methods

Adds a new sample

Parameters:
Name Type Description
time JulianDate The sample time.
value Object The value at the provided time.
Throws:

Adds an array of samples

Parameters:
Name Type Description
times Array An array of JulianDate instances where each index is a sample time.
values Array The array of values, where each value corresponds to the provided times index.
Throws:

Adds samples as a single packed array where each new sample is represented as a date, followed by the packed representation of the corresponding value.

Parameters:
Name Type Argument Description
packedSamples Array The array of packed samples.
epoch JulianDate <optional>
If any of the dates in packedSamples are numbers, they are considered an offset from this epoch, in seconds.
Throws:
DeveloperError : packedSamples is required.

Compares this property to the provided property and returns true if they are equal, false otherwise.

Parameters:
Name Type Argument Description
other Property <optional>
The other property.
Returns:
Boolean true if left and right are equal, false otherwise.

Gets the value of the property at the provided time.

Parameters:
Name Type Argument Description
time JulianDate The time for which to retrieve the value.
result Object <optional>
The object to store the value into, if omitted, a new instance is created and returned.
Throws:
DeveloperError : time is required.
Returns:
Object The modified result parameter or a new instance if the result parameter was not supplied.