6 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
9 class axlCompositeCurveConverterPrivate
28 return "Converter from axlCompositeCurve to axlMesh";
33 return "axlCompositeCurveConverter";
38 return QStringList() <<
"axlCompositeCurveConverter" <<
"axlCompositeCurve";
47 return dtkAbstractDataFactory::instance()->registerDataConverterType(
"axlCompositeCurveConverter", QStringList(),
"axlMesh",
createaxlCompositeCurveConverter);
51 void axlCompositeCurveConverter::addMesh2Mesh(
axlMesh& mother_mesh,
axlMesh *child_mesh)
53 QVector<axlMesh::Edge> edge_of_child_mesh = child_mesh->
edgeSet();
55 qDebug()<<
"count_vertex = "<<count_vertex;
64 for(
int i = 0; i<edge_of_child_mesh.size(); i++)
66 QVector<int> temp(edge_of_child_mesh.at(i).size());
68 for(
int j = 0; j < edge_of_child_mesh.at(i).size(); ++j)
70 temp.insert(j, edge_of_child_mesh.at(i).at(j) + count_vertex );
73 qDebug()<< edge_of_child_mesh.at(i).at(j)<<
" ---> "<<edge_of_child_mesh.at(i).at(j) + count_vertex;
81 axlPoint *
rotatePoint(
double a,
double b,
double c,
double x,
double y,
double z,
double u,
double v,
double w,
double alpha)
84 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);
85 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);
86 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);
105 double n = point.
norm();
160 QList<axlPoint *> result;
162 if(
axlLine *line = dynamic_cast<axlLine *>(curve))
164 result.append(line->firstPoint());
165 result.append(line->secondPoint());
167 else if(
axlCircleArc *ca = dynamic_cast<axlCircleArc *>(curve))
179 for(
int i = 0; i<=40;i++)
186 double step = (curvepara->endParam()-curvepara->startParam())/40;
187 for(
int i = 0;i<41;i++)
189 result.append(
new axlPoint(curvepara->eval(curvepara->startParam()+i*step)));
203 if(d->data->getCase())
205 QList<QList<axlPoint *> > $list;
206 for(
int i = 0; i<d->data->count_curve(); ++i)
208 $list.append(
Sampling(d->data->get_pt_curve_at_id(i)));
211 for(
int i = 0; i<$list.size(); ++i)
214 for(
int j = 0; j<$list.at(i).size(); ++j)
bool isDirect(void) const
Class axlPoint defines 3D points.
double vertexZ(const int &ind) const
return Z coordinates of vertex with index ind.
QVector< Edge > edgeSet(void) const
Class axlLine defines 3D lines.
axlCompositeCurveConverter(void)
~axlCompositeCurveConverter(void)
axlPoint * RotatePoint(axlPoint a, axlPoint x, axlPoint u, double alpha)
bool vertex_show(void) const
axlPoint point1(void) const
void push_back_edge(int, int)
void normalize(axlPoint &point)
QString toType(void) const
double angleOfArc(const axlCircleArc *arc)
axlPoint * secondPoint(void) const
Returns second point of the line.
bool normal_used(void) const
axlPoint center(void) const
axlPoint normalCCWArc(const axlCircleArc &arc)
bool edge_show(void) const
QString description(void) const
static bool registered(void)
axlPoint * firstPoint(void) const
Returns first point of the line.
dtkAbstractDataConverter * createaxlCompositeCurveConverter(void)
QStringList fromTypes(void) const
axlPoint point2(void) const
double vertexY(const int &ind) const
return Y coordinates of vertex with index ind.
QString identifier(void) const
void setData(dtkAbstractData *data)
static double dotProduct(const axlPoint &lhs, const axlPoint &rhs)
axlPoint * rotatePoint(double a, double b, double c, double x, double y, double z, double u, double v, double w, double alpha)
QList< axlPoint * > Sampling(axlAbstractCurve *curve)
bool face_show(void) const
axlPoint calculateNormal(void) const
bool color_used(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).
double vertexX(const int &ind) const
Return X coordinates of vertex with index ind.
void setCoordinates(double x, double y, double z)
Change coordinates of this point.
int vertex_count(void) const
Class axlMesh defines a piecewise-linear 3D object.
double angle(axlPoint vCompute, axlPoint vRef, axlPoint normal)
void push_back_vertex(const double &x, const double &y, const double &z)
Add a new vertex to the mesh.