52 _cvData.push_back(
CV(position, val, type));
65 int realCVs =
static_cast<int>(
_cvData.size()) - 2;
70 begin._interp =
kNone;
71 int lastIndex =
static_cast<int>(
_cvData.size()) - 1;
76 begin._pos = end._pos = 0;
77 begin._val = end._val = T();
78 begin._interp =
kNone;
79 begin._deriv = end._deriv = T();
83 for (
unsigned int i = 1; i <
_cvData.size() - 1; i++) {
88 for (
unsigned int i = 0; i <
_cvData.size() - 1; i++) {
107 const int numPoints =
static_cast<int>(
_cvData.size());
110 static_cast<int>(std::upper_bound(cvDataBegin, cvDataBegin + numPoints,
CV(param, T(),
kLinear),
cvLessThan) - cvDataBegin);
111 index = std::max(1, std::min(
index, numPoints - 1));
113 const float t0 =
static_cast<float>(
_cvData[
index - 1]._pos);
116 const float t1 =
static_cast<float>(
_cvData[
index]._pos);
123 double u = (param - t0) / (t1 - t0);
124 return k0 + u * (k1 - k0);
127 double u = (param - t0) / (t1 - t0);
128 return k0 * (u - 1) * (u - 1) * (2 * u + 1) + k1 * u * u * (3 - 2 * u);
138 return (
x * (delta * (3 * h - 2 *
x) *
x + h * (-h +
x) * (-(d1 * h) + (d1 + d2) *
x))) / (h * h * h) +
y;
153 const int numPoints =
static_cast<int>(
_cvData.size());
156 static_cast<int>(std::upper_bound(cvDataBegin, cvDataBegin + numPoints,
CV(param, T(),
kLinear),
cvLessThan) - cvDataBegin);
157 index = std::max(1, std::min(
index, numPoints - 1));
159 const float t0 =
static_cast<float>(
_cvData[
index - 1]._pos);
162 const float t1 =
static_cast<float>(
_cvData[
index]._pos);
169 double u = (param - t0) / (t1 - t0);
170 return k0 + u * (k1 - k0);
175 double u = (param - t0) / (t1 - t0);
176 return k0 * (u - 1) * (u - 1) * (2 * u + 1) + k1 * u * u * (3 - 2 * u);
189 return (
x * (delta * (3 * h - 2 *
x) *
x + h * (-h +
x) * (-(d1 * h) + (d1 + d2) *
x))) / (h * h * h) +
y;
202 int numPoints =
static_cast<int>(
_cvData.size());
204 static_cast<int>(std::upper_bound(cvDataBegin, cvDataBegin + numPoints,
CV(param, T(),
kLinear),
cvLessThan) - cvDataBegin);
205 index = std::max(1, std::min(
index, numPoints - 1));
227 for (
int i = 0; i < 3; i++) {
Interpolation curve class for double->double and double->Vec3D.
static double comp(const T &val, const int i)
Returns a component of the given value.
static bool cvLessThan(const CV &cv1, const CV &cv2)
CV Parameter ordering (cv1._pos < cv2._pos)
double getChannelValue(const double param, int channel) const
CV getLowerBoundCV(const double param) const
InterpType
Supported interpolation types.
T getValue(const double param) const
Evaluates curve and returns full value.
static bool interpTypeValid(InterpType interp)
Returns whether the given interpolation type is supported.
void clampCurveSegment(const TVAL &delta, TVAL &d1, TVAL &d2)
void addPoint(double position, const T &val, InterpType type)
Adds a point to the curve.
std::vector< CV > _cvData
void preparePoints()
Prepares points for evaluation (sorts and computes boundaries, clamps extrema)
Vec< double, 3, false > Vec3d
double clamp(double x, double lo, double hi)
</pre >< h3 > A simple variable reference</h3 > This is not a very interesting subclass of expression until we add some additional variables Variables on some applications may be very dynamic In this we only need x
This is the same as the prman cellnoise function< br ></div >< br > float< b > float y< br > float< b > float y
The result is computed int int< br >< div style="margin-left: 40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed).