11 #include <dtkCoreSupport/dtkAbstractDataFactory.h> 
   14 class axlSurfaceRevolutionConverterPrivate
 
   35     return "Converter from axlSurfaceRevolution to axlMesh";
 
   40     return "axlSurfaceRevolutionConverter";
 
   45     return QStringList() << 
"axlSurfaceRevolutionConverter" << 
"axlSurfaceRevolution";
 
   57 axlPoint *axlSurfaceRevolutionConverter::rotatePoint(
double a, 
double b, 
double c, 
double x, 
double y,
double z, 
double u, 
double v, 
double w, 
double alpha)
 
   60     qreal a1 = (a*(qPow(v,2)+qPow(w,2))-u*(b*v+c*w-u*x-v*y-w*z))*(1-qCos(alpha))+x*qCos(alpha)+(-c*v+b*w-w*y+v*z)*qSin(alpha);
 
   61     qreal a2 = (b*(qPow(u,2)+qPow(w,2))-v*(a*u+c*w-u*x-v*y-w*z))*(1-qCos(alpha))+y*qCos(alpha)+(c*u-a*w+w*x-u*z)*qSin(alpha);
 
   62     qreal a3 = (c*(qPow(u,2)+qPow(v,2))-w*(a*u+b*v-u*x-v*y-w*z))*(1-qCos(alpha))+z*qCos(alpha)+(-b*u+a*v-v*x+u*y)*qSin(alpha);
 
   69     return rotatePoint(a.
x(),a.
y(),a.
z(),x.
x(),x.
y(),x.
z(),u.
x(),u.
y(),u.
z(),alpha);
 
   76     return RotatePoint(*(line->
firstPoint()),*x,dir,alpha);
 
   88 double axlSurfaceRevolutionConverter::angleOfArc(
const axlCircleArc *arc)
 
  125 QList<axlPoint *> axlSurfaceRevolutionConverter::Sampling(
axlAbstractCurve *curve)
 
  127     QList<axlPoint *> result;
 
  129     if(
axlLine *line = dynamic_cast<axlLine *>(curve))
 
  134     else if(
axlCircleArc *ca = dynamic_cast<axlCircleArc *>(curve))
 
  136         double step = angleOfArc(ca)/40;
 
  145         for(
int i = 0; i<=40;i++)
 
  148             result.append(RotatePoint(
new axlLine(ca->center(),ca->center()+normalCCWArc(*ca)),inter,i*step));
 
  153         double step = (curvepara->endParam()-curvepara->startParam())/40;
 
  154         for(
int i = 0;i<41;i++)
 
  156             result.append(
new axlPoint(curvepara->eval(curvepara->startParam()+i*step)));
 
  170     double step = (d->data->getEndAngle()-d->data->getStartAngle())/NoS;
 
  171     QList<QList<axlPoint *> > samples;
 
  172     for(
int i = 0; i<d->data->countCurve(); i++)
 
  174         QList<axlPoint *> temp = Sampling(d->data->getCurve(i));
 
  175         samples.append(temp);
 
  178     for(
int k = 0; k<samples.size(); k++)
 
  180         for(
int i = 0;i<samples.at(k).size();i++)
 
  182             for(
int j = 0;j<NoS+1;j++)
 
  184                 output->
push_back_vertex(RotatePoint(d->data->getAxe(),samples.at(k).value(i),d->data->getStartAngle()+j*step));
 
  188         for(
int i = 0; i < samples.at(k).size()-1; i++)
 
  190             for(
int j= 0; j <NoS; j++)
 
  192                 i1 = lastID + i * (NoS+1) + j;
 
  195                 QVector<int> firstTriangle;
 
  196                 QVector<int> secondTriamgle;
 
  198                 firstTriangle.push_back(i1);
 
  199                 firstTriangle.push_back(i1 + 1);
 
  200                 firstTriangle.push_back(i2);
 
  202                 secondTriamgle.push_back(i2);
 
  203                 secondTriamgle.push_back(i1 + 1);
 
  204                 secondTriamgle.push_back(i2 + 1);
 
  214         for(
int i = 0; i < NoS+1 ; i++)
 
  220         for(
int j = 0; j < samples.at(k).size() ; j++)
 
  222             ed1<<lastID + (NoS+j*(NoS+1));
 
  227         for(
int i = 0; i < NoS+1 ; i++)
 
  229             ed2<<lastID + (samples.at(k).size()-2)*(NoS+1) + (NoS-i);
 
  233         for(
int j = 0; j < samples.at(k).size() ; j++)
 
  235             ed3<<lastID + (samples.at(k).size()-1-j)*(NoS+1);
 
  239         lastID+=samples.at(k).size()*(NoS+1);
 
bool isDirect(void) const 
QString toType(void) const 
Class axlPoint defines 3D points. 
Class axlLine defines 3D lines. 
bool vertex_show(void) const 
axlPoint point1(void) const 
void push_back_edge(int, int)
axlPoint * secondPoint(void) const 
Returns second point of the line. 
QVector< int > Edge
An edge is represented by a sequence of vertices. 
axlPoint center(void) const 
dtkAbstractDataConverter * createaxlSurfaceRevolutionConverter(void)
QStringList fromTypes(void) const 
~axlSurfaceRevolutionConverter(void)
static bool registered(void)
void setData(dtkAbstractData *data)
axlPoint * firstPoint(void) const 
Returns first point of the line. 
axlPoint point2(void) const 
static double dotProduct(const axlPoint &lhs, const axlPoint &rhs)
bool face_show(void) const 
axlPoint calculateNormal(void) const 
QString description(void) const 
void push_back_face(const Face &face)
QString identifier(void) const 
axlPoint normal(void) const 
static axlPoint crossProduct(const axlPoint &lhs, const axlPoint &rhs)
Returns the cross product between lhs (coords) and rhs (coords). 
void setCoordinates(double x, double y, double z)
Change coordinates of this point. 
axlSurfaceRevolutionConverter(void)
Class axlMesh defines a piecewise-linear 3D object. 
void push_back_vertex(const double &x, const double &y, const double &z)
Add a new vertex to the mesh.