ok
the function i have to call il
void run()
{
MesDomain *domain;
domain=new MesDomain();
std::vector<MesPoint> p;
std::vector<MesEndPoints> s;
std::vector<MesPoint> v;
...
domain->setPolygon(p,s,h);
domain->computeQuadrangulation();
...
delete domain
}
void run()
{
MesDomain *domain;
domain=new MesDomain();
std::vector<MesPoint> p;
std::vector<MesEndPoints> s;
std::vector<MesPoint> v;
...
domain->setPolygon(p,s,h);
domain->computeQuadrangulation();
...
delete domain
}
To copy to clipboard, switch view to plain text mode
here is class MesDomain
class MesDomain
{
private:
MesPolygon *polygon;
MesNodes *nodes;
MesEdges *edges;
MesElements *elements;
CQMesh *mesh;
public:
MesDomain();
~MesDomain();
void setPolygon(std::vector<MesPoint>, std::vector<MesEndPoints>, std::vector<MesPoint> );
void computeQuadrangulation();
void saveQuadrangulation(std::string);
private:
void computeTriangulation(triangulateio *);
};
class MesDomain
{
private:
MesPolygon *polygon;
MesNodes *nodes;
MesEdges *edges;
MesElements *elements;
CQMesh *mesh;
public:
MesDomain();
~MesDomain();
void setPolygon(std::vector<MesPoint>, std::vector<MesEndPoints>, std::vector<MesPoint> );
void computeQuadrangulation();
void saveQuadrangulation(std::string);
private:
void computeTriangulation(triangulateio *);
};
To copy to clipboard, switch view to plain text mode
and its methods:
void MesDomain::setPolygon(std::vector<MesPoint> v, std::vector<MesEndPoints> s, std::vector<MesPoint> h) {
for (std::vector<MesPoint>::iterator it=v.begin(); it!=v.end(); ++it) polygon->addVertex(*it);
for (std::vector<MesEndPoints>::iterator it=s.begin(); it!=s.end(); ++it) polygon->addSegment(*it);
for (std::vector<MesPoint>::iterator it=h.begin(); it!=h.end(); ++it) polygon->addHole(*it);
}
void MesDomain::setPolygon(std::vector<MesPoint> v, std::vector<MesEndPoints> s, std::vector<MesPoint> h) {
for (std::vector<MesPoint>::iterator it=v.begin(); it!=v.end(); ++it) polygon->addVertex(*it);
for (std::vector<MesEndPoints>::iterator it=s.begin(); it!=s.end(); ++it) polygon->addSegment(*it);
for (std::vector<MesPoint>::iterator it=h.begin(); it!=h.end(); ++it) polygon->addHole(*it);
}
To copy to clipboard, switch view to plain text mode
void MesDomain::computeQuadrangulation() {
triangulateio *triangulation;
triangulation = new triangulateio;
...
computeTriangulation(triangulation);
...
}
void MesDomain::computeQuadrangulation() {
triangulateio *triangulation;
triangulation = new triangulateio;
...
computeTriangulation(triangulation);
...
}
To copy to clipboard, switch view to plain text mode
void MesDomain::computeTriangulation(triangulateio *out) {
triangulateio in;
...
char * opt = ...;
triangulate(opt, &in, out, 0);
}
void MesDomain::computeTriangulation(triangulateio *out) {
triangulateio in;
...
char * opt = ...;
triangulate(opt, &in, out, 0);
}
To copy to clipboard, switch view to plain text mode
and triangulateio and triangulate are defined in the C library
Bookmarks