22 #include <dtkCoreSupport/dtkGlobal.h>
23 #include <QtCore/qmap.h>
27 class axlAbstractVolumeBSplinePrivate
30 QMap<axlPoint, double> scalar_values;
31 QHash<int, QList<int> >connect;
47 DTK_DEFAULT_IMPLEMENTATION;
53 DTK_DEFAULT_IMPLEMENTATION;
59 DTK_DEFAULT_IMPLEMENTATION;
65 DTK_DEFAULT_IMPLEMENTATION;
71 DTK_DEFAULT_IMPLEMENTATION;
78 DTK_DEFAULT_IMPLEMENTATION;
84 DTK_DEFAULT_IMPLEMENTATION;
90 DTK_DEFAULT_IMPLEMENTATION;
97 DTK_DEFAULT_IMPLEMENTATION;
103 DTK_DEFAULT_IMPLEMENTATION;
109 DTK_DEFAULT_IMPLEMENTATION;
116 DTK_DEFAULT_IMPLEMENTATION;
122 DTK_DEFAULT_IMPLEMENTATION;
127 DTK_DEFAULT_IMPLEMENTATION;
133 DTK_DEFAULT_IMPLEMENTATION;
139 DTK_DEFAULT_IMPLEMENTATION;
146 DTK_DEFAULT_IMPLEMENTATION;
152 DTK_DEFAULT_IMPLEMENTATION;
158 DTK_DEFAULT_IMPLEMENTATION;
164 DTK_DEFAULT_IMPLEMENTATION;
170 DTK_DEFAULT_IMPLEMENTATION;
176 DTK_DEFAULT_IMPLEMENTATION;
182 DTK_DEFAULT_IMPLEMENTATION;
189 DTK_DEFAULT_IMPLEMENTATION;
190 QVector<axlPoint *> qVect;
196 DTK_DEFAULT_IMPLEMENTATION;
199 void axlAbstractVolumeBSpline::setVolume(
int pointsCount_u,
int pointsCount_v,
int pointsCount_w,
int order_u,
int order_v,
int order_w,
int dimension,
double *knots_u,
double *knots_v,
double *knots_w,
double *points,
bool rational)
201 DTK_DEFAULT_IMPLEMENTATION;
237 DTK_DEFAULT_IMPLEMENTATION;
243 DTK_DEFAULT_IMPLEMENTATION;
249 DTK_DEFAULT_IMPLEMENTATION;
257 return d->scalar_values.value(point);
265 d->scalar_values.insert(point, value);
274 return !d->connect.isEmpty();
292 return d->connect.value(i);
302 qDebug() <<
"The two indices must be different.";
304 int mini = std::min(i,j);
305 int maxi = std::max(i,j);
307 if(d->connect.keys().contains(mini)){
308 QList<int> list = d->connect.value(mini);
310 if(!list.contains(maxi) ){
312 d->connect.insert(mini, list);
317 d->connect.insert(mini,list);
325 list.append(identifier());
332 QVariant orderu = QVariant::fromValue(
order_u());
334 QVariant orderv = QVariant::fromValue(
order_v());
336 QVariant orderw = QVariant::fromValue(
order_w());
338 QVariant
dimension = QVariant::fromValue(3);
339 list.append(dimension);
341 for(
int i = 0; i < nu.toInt()+
order_u();i++){
345 for(
int i = 0; i < nv.toInt()+
order_v();i++){
349 for(
int i = 0; i < nw.toInt()+
order_w();i++){
353 for(
int i = 0; i < nu.toInt()*nv.toInt()*nw.toInt();i++){
356 QVariant name = QVariant::fromValue(objectName());
362 int nu = data.at(1).toInt();
363 int nv = data.at(2).toInt();
364 int nw = data.at(3).toInt();
365 int orderu = data.at(4).toInt();
366 int orderv = data.at(5).toInt();
367 int orderw = data.at(6).toInt();
370 double *knotsU =
new double[nu+orderu];
371 for(
int i = 0; i < nu+orderu;i++){
372 knotsU[i] = data.at(i+8).toDouble();
376 double *knotsV =
new double[nv+orderv];
377 for(
int i = 0; i < nv+orderv;i++){
378 knotsV[i] = data.at(i+8 +nu+orderu).toDouble();
382 double *knotsW =
new double[nw+orderw];
383 for(
int i = 0; i < nw+orderw;i++){
384 knotsW[i] = data.at(i+8 +nu+orderu +nv+orderv).toDouble();
388 int indice = 8 +nu+orderu +nv+orderv +nw+orderw;
389 double *CP =
new double[3*nu*nv*nw];
390 for(
int i = 0; i < nu*nv*nw;i++){
392 list.append(data.at(indice));
393 list.append(data.at(indice+1));
394 list.append(data.at(indice+2));
395 list.append(data.at(indice+3));
396 list.append(data.at(indice+4));
400 CP[3*i] = point->
x();
401 CP[3*i+1] = point->
y();
402 CP[3*i+2] = point->
z();
406 setVolume(nu,nv,nw ,orderu,orderv,orderw,dimension,knotsU, knotsV,knotsW,CP,
false);
407 setObjectName(data.last().toString());
Class axlPoint defines 3D points.
virtual double getKnot_v(int n) const
virtual void removeKnot_u(double k)
virtual int order_u(void) const
virtual int order_v(void) const
int convertQVariantToData(const QVariantList &data)
Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was suc...
virtual int countControlPoints_v(void) const
virtual void insertKnot_v(double k)
double scalarValue(double u, double v, double w)
axlAbstractVolumeBSpline(void)
virtual QString printCoeffs(bool print) const
QVariantList convertDataToQVariant(void) const
Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData...
virtual int order_w(void) const
virtual axlPoint getCoef(int n, int m, int k) const
virtual void insertKnot_w(double k)
virtual int dimension(void) const
virtual void updateRcoeff()
virtual int knotVectorSize_v(void) const
virtual void resetControlPointConnections(void)
Removes all control point connections.
virtual double getWeight(int n, int m, int k) const
virtual void insertKnot_u(double k)
virtual void removeKnot_v(double k)
virtual double getKnot_u(int n) const
void setScalarValue(double u, double v, double w, double value)
virtual int countControlPoints_u(void) const
virtual void gridEvaluator(int num_u, int num_v, int num_w, std::vector< double > &points, std::vector< double > ¶m_u, std::vector< double > ¶m_v, std::vector< double > ¶m_w)
virtual QVector< axlPoint * > sampling()
virtual int knotVectorSize_w(void) const
virtual QString description(void) const
virtual int countControlPoints_w(void) const
virtual int countControlPoints(void) const
virtual void removeKnot_w(double k)
virtual bool rational(void) const
virtual axlAbstractVolumeBSpline * copy(void) const
virtual ~axlAbstractVolumeBSpline(void)
virtual bool connectionsAreDefined(void)
Return true if control points connections were defined by developers. False if there are default conn...
int convertQVariantToData(const QVariantList &data)
Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was suc...
virtual bool setCoef(int n, int m, int k, int v, double c)
void setCoordinates(double x, double y, double z)
Change coordinates of this point.
virtual double getKnot_w(int n) const
virtual void defineControlPointConnection(int i, int j)
Define connection between the ith and the jth coefficient.
virtual double getCoord(int n, int m, int k, int v) const
virtual void setVolume(int pointsCount_u, int pointsCount_v, int pointsCount_w, int order_u, int order_v, int order_w, int dimension, double *knots_u, double *knots_v, double *knots_w, double *points, bool rational)
virtual int knotVectorSize_u(void) const
virtual QString printKnotsVector(bool print) const
virtual QList< int > getControlPointConnection(int i)
The list returned contains all indices of coefficients that are still to be connected to the ith coef...