8 #include "Catmullrom3D.h"
11 #define thisTTClass Catmullrom3D
12 #define thisTTClassName "spline.catmullrom.3D"
13 #define thisTTClassTags "audio, trajectory, 3D, spline"
30 Catmullrom3D::~Catmullrom3D()
41 void Catmullrom3D::interpolate(t_spline *x, t_point pt0, t_point pt1, t_point pt2, t_point pt3)
45 double m0, m1, m2, m3;
46 double a0, a1, a2, a3;
51 m0 = 2.0 * s3 - 3.0 * s2 + 1.0;
52 m1 = -2.0 * s3 + 3.0 * s2;
56 a0 = 0.5 * ( pt2.x - pt0.x );
57 a1 = 0.5 * ( pt3.x - pt1.x );
58 x->b_result[0].a_w.w_float = (m0 * pt1.x + m1 * pt2.x + m2 * a0 + m3 * a1);
60 a0 = 0.5 * ( pt2.y - pt0.y );
61 a1 = 0.5 * ( pt3.y - pt1.y );
62 x->b_result[1].a_w.w_float = (m0 * pt1.y + m1 * pt2.y + m2 * a0 + m3 * a1);
64 a0 = 0.5 * ( pt2.z - pt0.z);
65 a1 = 0.5 * ( pt3.z - pt1.z);
66 x->b_result[2].a_w.w_float = (m0 * pt1.z + m1 * pt2.z + m2 * a0 + m3 * a1);
70 void Catmullrom3D::spline_exec(t_spline *x)
77 spline_make_endpoints(x);
78 spline_stepthrough(x);
79 x->b_result[0].a_w.w_float = x->b_control[x->b_size - 1].x;
80 x->b_result[1].a_w.w_float = x->b_control[x->b_size - 1].y;
81 x->b_result[2].a_w.w_float = x->b_control[x->b_size - 1].z;
82 outlet_list(x->b_outlet1, 0L, x->b_dim, x->b_result);
83 outlet_bang(x->b_outlet2);
154 if (numOutputChannels != 3) {
157 out.setNumChannels(v);
161 TTUInt16 vs = in0.getVectorSizeAsInt();
169 for (
int i=0; i<vs; i++) {
171 f = inSampleX[i] * 0.5;
173 if ((f > 0) && (f < 1)){
177 outSampleX[i] = b_op[0];
178 outSampleY[i] = b_op[1];
179 outSampleZ[i] = b_op[2];
180 }
else if (f <= 0.0){
182 }
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...
#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.
Boolean (1/0) or (true/false) flag.
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]