1 #ifndef cubicbeziercurve_h 2 #define cubicbeziercurve_h 15 #include "geometrymod.h" 26 int firstparam=0,
int step=1 );
30 Coord3 computePosition(
float )
const;
31 Coord3 computeTangent(
float )
const;
50 float directionInfluence()
const;
51 void setTangentInfluence(
float);
53 bool isCircular()
const;
54 bool setCircular(
bool yn);
58 {
return mCast(
int,(param-firstparam)/paramstep); }
77 if (
mIsZero(u,1e-3) )
return *p;
78 else if (
mIsEqual(u,1,1e-3) )
return p[3*di];
80 const float one_minus_u = 1-u;
81 Coord3 interpolpos1 = p[di]*one_minus_u+p[di*2] * u;
83 const Coord3 interpolpos0 = (*p*one_minus_u+p[di]*u) * one_minus_u +
86 interpolpos1 = interpolpos1 * one_minus_u +
87 (p[di*2]*one_minus_u+p[3*di]*u) * u;
89 return interpolpos0*one_minus_u+interpolpos1*u;
97 if (
mIsZero(u,1e-3) )
return p[di]-*p;
98 else if (
mIsEqual(u,1,1e-3) )
return p[3*di]-p[2*di];
100 const float one_minus_u = 1-u;
101 Coord3 interpolpos1 = p[di]*one_minus_u+p[2*di] * u;
103 const Coord3 interpolpos0 = (*p*one_minus_u+p[di]*u) * one_minus_u +
106 interpolpos1 = interpolpos1 * one_minus_u +
107 (p[2*di]*one_minus_u+p[3*di]*u) * u;
109 return interpolpos1-interpolpos0;
#define mExpClass(module)
Definition: commondefs.h:160
A curve that is defined by regularly sampled positions.
Definition: parametriccurve.h:32
float directioninfluence
Definition: cubicbeziercurve.h:66
Coord3 cubicDeCasteljauTangent(const Coord3 *p, char i0, char di, float u)
Definition: cubicbeziercurve.h:93
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
#define mIsZero(x, eps)
Definition: commondefs.h:53
#define mCast(tp, v)
Definition: commondefs.h:124
Coord3 cubicDeCasteljau(const Coord3 *p, char i0, char di, float u)
Definition: cubicbeziercurve.h:74
int firstparam
Definition: cubicbeziercurve.h:62
#define mIsEqual(x, y, eps)
Definition: commondefs.h:54
od_int64 GeomPosID
Definition: geomelement.h:21
TypeSet< Coord3 > directions
Definition: cubicbeziercurve.h:65
int getIndex(GeomPosID param) const
Definition: cubicbeziercurve.h:57
Class to store ranges in N dimensions.
Definition: ranges.h:209
bool iscircular
Definition: cubicbeziercurve.h:68
Definition: cubicbeziercurve.h:22
A cartesian coordinate in 3D space.
Definition: coord.h:72
TypeSet< Coord3 > positions
Definition: cubicbeziercurve.h:64
int paramstep
Definition: cubicbeziercurve.h:63
Definition: arraytesselator.h:21