mirror of https://github.com/CGAL/cgal
output only considers selected volumes
facets in output are consistently oriented outwards, now
This commit is contained in:
parent
b238d22d5b
commit
4c110cb402
|
|
@ -51,42 +51,45 @@ typedef Nef_polyhedron_3::SHalfloop_const_handle SHalfloop_const_handle;
|
||||||
typedef Nef_polyhedron_3::SFace_const_handle SFace_const_handle;
|
typedef Nef_polyhedron_3::SFace_const_handle SFace_const_handle;
|
||||||
typedef CGAL::Trunk_offset<Nef_polyhedron_3> TO;
|
typedef CGAL::Trunk_offset<Nef_polyhedron_3> TO;
|
||||||
|
|
||||||
class Facet_counter {
|
|
||||||
int counter;
|
|
||||||
public:
|
|
||||||
Facet_counter() : counter(0) {}
|
|
||||||
void visit(Halffacet_const_handle f) {
|
|
||||||
++counter;
|
|
||||||
}
|
|
||||||
void visit(SFace_const_handle s) {}
|
|
||||||
void visit(Halfedge_const_handle e) {}
|
|
||||||
void visit(Vertex_const_handle v) {}
|
|
||||||
void visit(SHalfedge_const_handle se) {}
|
|
||||||
void visit(SHalfloop_const_handle sl) {}
|
|
||||||
int get_counter() const { return counter; }
|
|
||||||
void reset_counter() { counter=0; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class Volume_output {
|
class Volume_output {
|
||||||
|
bool twin;
|
||||||
|
std::vector<Plane_3> planes;
|
||||||
|
typedef std::vector<Plane_3>::const_iterator CI;
|
||||||
public:
|
public:
|
||||||
Volume_output() {}
|
Volume_output(bool twin_ = true) : twin(twin_){}
|
||||||
|
bool is_in(const Plane_3 p) {
|
||||||
|
for(CI ci = planes.begin(); ci != planes.end(); ++ci)
|
||||||
|
if(*ci == p)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void visit(Halffacet_const_handle f) {
|
void visit(Halffacet_const_handle f) {
|
||||||
/*
|
if(twin) f = f->twin();
|
||||||
#ifdef CGAL_WITH_LAZY_KERNEL
|
|
||||||
Plane_3 p = f->twin()->plane();
|
Plane_3 p = f->twin()->plane();
|
||||||
std::cout << p.a().exact()
|
if(!is_in(p))
|
||||||
<< p.b().exact()
|
planes.push_back(p);
|
||||||
<< p.c().exact() << std::endl;
|
|
||||||
#else
|
|
||||||
*/
|
|
||||||
std::cout << f->twin()->plane() << std::endl;
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
void visit(SFace_const_handle s) {}
|
void visit(SFace_const_handle s) {}
|
||||||
void visit(Halfedge_const_handle e) {}
|
void visit(Halfedge_const_handle e) {}
|
||||||
void visit(Vertex_const_handle v) {}
|
void visit(Vertex_const_handle v) {}
|
||||||
void visit(SHalfedge_const_handle se) {}
|
void visit(SHalfedge_const_handle se) {}
|
||||||
void visit(SHalfloop_const_handle sl) {}
|
void visit(SHalfloop_const_handle sl) {}
|
||||||
|
|
||||||
|
void dump() const {
|
||||||
|
std::cout << planes.size() << std::endl;
|
||||||
|
for(CI ci = planes.begin(); ci != planes.end(); ++ci) {
|
||||||
|
#ifdef CGAL_WITH_LAZY_KERNEL
|
||||||
|
std::cout << CGAL::to_double(ci->a().exact()) << " "
|
||||||
|
<< CGAL::to_double(ci->b().exact()) << " "
|
||||||
|
<< CGAL::to_double(ci->c().exact()) << " "
|
||||||
|
<< CGAL::to_double(ci->d().exact()) << std::endl;
|
||||||
|
#else
|
||||||
|
std::cout << *ci << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void read( const char* name, Polyhedron_3& poly) {
|
void read( const char* name, Polyhedron_3& poly) {
|
||||||
|
|
@ -210,18 +213,23 @@ int main(int argc, char* argv[]) {
|
||||||
<< t.time() << std::endl;
|
<< t.time() << std::endl;
|
||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
Facet_counter fc;
|
|
||||||
Volume_output vout;
|
|
||||||
Volume_const_iterator c;
|
|
||||||
|
|
||||||
std::cout << DIFF.number_of_volumes() << std::endl;
|
int nov = 1;
|
||||||
std::cout << NCV.number_of_facets() << std::endl;
|
Volume_const_iterator c;
|
||||||
NCV.visit_shell_objects(NCV.volumes_begin()->shells_begin(), vout);
|
for(c=++(DIFF.volumes_begin()); c!=DIFF.volumes_end(); ++c)
|
||||||
|
if(c->mark()) ++nov;
|
||||||
|
std::cout << nov << std::endl;
|
||||||
|
|
||||||
|
Volume_output vout_ncv;
|
||||||
|
NCV.visit_shell_objects(NCV.volumes_begin()->shells_begin(), vout_ncv);
|
||||||
|
vout_ncv.dump();
|
||||||
|
|
||||||
for(c=++(DIFF.volumes_begin()); c!=DIFF.volumes_end(); ++c) {
|
for(c=++(DIFF.volumes_begin()); c!=DIFF.volumes_end(); ++c) {
|
||||||
fc.reset_counter();
|
if(c->mark()) {
|
||||||
DIFF.visit_shell_objects(c->shells_begin(), fc);
|
Volume_output vout(true);
|
||||||
std::cout << fc.get_counter() << std::endl;
|
DIFF.visit_shell_objects(c->shells_begin(), vout);
|
||||||
DIFF.visit_shell_objects(c->shells_begin(), vout);
|
vout.dump();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t.stop();
|
t.stop();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue