IRangeValue

1. Definition

is a data type, which makes it possible to specify a range of values instead of a concrete value. This range is defined by two bounding curves.The curves represent values at a given time. If only one curve is defined the RangeValue are the values of this curve at a given time. If two curves are defined the RangeValue outputs a random value between the values of the two curves at a given time. See Examples. It is also possible that instead of a random value weighting is taken, see IParticleRangeValue.

IRangeValue
  function GetValue (const Time: Double): Double;
  procedure SetValue (const ItemIndex: Integer; const Time: Double; const Value: Single);
  procedure Clear;
  procedure Assign(const Other: IScripting_IRangeValue);
end;

2. Methods

  • Sets values: SetValue or SetValueX, SetValueY, SetValueZ and SetValueXYZ. For parameters see here. SetValueXYZ sets the same value for all dimensions.
    procedure SetValue (const ItemIndex: Integer; const Time: Double; const Value: Single);
    
  • Returns the value at Time, analogous to the setter.
    function GetValue (const Time: Double): Double;
    
  • Delete all values
    procedure Clear;
  • Assign values from another IParticleRangeValue:
    procedure Assign(const Other: IParticleVectorRangeValue);

3. Examples

Example 1: A Range Value shall be a constant function. Then only the first curve is filled with values:p>

RangeValue.SetValue(0, 0, 10); //Parameter: curve index, time, value

This code says that the limiting curve 0 at time 0 is given the value 10. Due to the interpolation, the curve has at any other time also the value 10.


Example 2: Two values are assigned to RangeValue

procedure Assign(const Other: IParticleVectorRangeValue);
RangeValue.SetValue(0, 0, 10);
RangeValue.SetValue(0, 1000, 20);

The RangeValue has still only a limiting curve. But it is no longer a constant: At time 0, it returns the value 0, at the time 1000 and higher the value 20. The values between 0 and 1000 are interpolated. At the time 500 RangeValue therefore could return the value 15. Thus, arbitrary curves can be constructed.


But the RangeValue may just have range information. If you define values for two limiting curves, you obtain a range. The RangeValue now returns a random value between the values of the two barriers (other cases: see Weighting under IParticleRangeValue).

Example 3: RangeValue with range information:

procedure Assign(const Other: IParticleVectorRangeValue);
RangeValue.SetValue(0, 0, 10);
RangeValue.SetValue(1, 0, 100);

Here the RangeValue receives two limiting curves. Both curves are constants, in this case with the values of 10 to 100. The RangeValue will return as a value at any given time a random value between 10 and 100.


Example 4: Non-constant barriers:

procedure Assign(const Other: IParticleVectorRangeValue);
RangeValue.SetValue(0, 0, 10);
RangeValue.SetValue(1, 0, 100);
RangeValue.SetValue(0, 1000, 20);
RangeValue.SetValue(1, 500, 50);

The RangeValue has now received two non-constant curves as barriers. So it will interpolate both curve values at time 500. Curve 0 has at the time 500 the value 15. Curve 1 has at the time 500 the value 50. Accordingly, the RangeValue returns at the time 500 a random value between 15 and 50.