11 #define thisTTClass Bspline2D
12 #define thisTTClassName "bspline.2D"
13 #define thisTTClassTags "audio, trajectory, 2D, spline"
29 Bspline2D::~Bspline2D()
40 void Bspline2D::calculatePoint()
49 for ( i = 0; i <= mResolution; i++) {
50 temp = calculateBlend(i, mDegree);
51 b_op[0] += b_control[i*3] * temp;
52 b_op[1] += b_control[i*3+1] * temp;
53 b_op[2] += b_control[i*3+2] * temp;
63 if ((b_knots[k] <= v) && (v < b_knots[k+1])) {
69 if ((b_knots[k + t - 1] == b_knots[k]) && (b_knots[k + t] == b_knots[k + 1])) {
71 }
else if (b_knots[k + t - 1] == b_knots[k]) {
72 value = (b_knots[k + t] - v) / (b_knots[k + t] - b_knots[k + 1]) * calculateBlend(k + 1, t - 1);
73 }
else if (b_knots[k + t] == b_knots[k + 1]) {
74 value = (v - b_knots[k]) / (b_knots[k + t - 1] - b_knots[k]) * calculateBlend(k, t - 1);
76 value = (v - b_knots[k]) / (b_knots[k + t - 1] - b_knots[k]) * calculateBlend(k, t - 1) +
77 (b_knots[k + t] - v) / (b_knots[k + t] - b_knots[k + 1]) * calculateBlend(k + 1, t - 1);
83 void Bspline2D::calculateKnots()
88 for (i = 0; i <= (n + t); i++){
91 }
else if ((t <= i) && (i <= n)) {
92 b_knots[i] = i - t + 1;
94 b_knots[i] = n - t + 2;
104 if (numOutputChannels != 2) {
107 out.setNumChannels(v);
111 TTUInt16 vs = in0.getVectorSizeAsInt();
118 for (
int i=0; i<vs; i++) {
120 f = inSampleX[i] * 0.5;
122 if ((f > 0) && (f < 1)){
123 interval = f * (
TTFloat64)((mResolution - mDegree) + 2);
125 outSampleX[i] = b_op[0];
126 outSampleY[i] = b_op[1];
128 }
else if (f <= 0.0){
130 }
else if (f >= 1.0){
std::uint16_t TTUInt16
16 bit unsigned integer
#define addAttribute(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter...
8-bit unsigned integer, range is 0 through 255.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
double TTFloat64
64 bit floating point number
16-bit unsigned integer, range is 0 through 65,535.
TTErr setMaxNumChannels(const TTValue &newMaxNumChannels)
Attribute accessor.
The TTAudioSignal class represents N vectors of audio samples for M channels.
TTSampleValue ** mSampleVectors
An array of pointers to the first sample in each vector. Declared Public for fast access...
TTUInt16 TTChannelCount
Data type used when counting the number of channels in multi-channel audio signals and processes...
A simple container for an array of TTAudioSignal pointers.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
[doxygenAppendixC_copyExample]
unsigned char TTUInt8
8 bit unsigned integer (char)