00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "print.h"
00015 #include "euler.h"
00016 #include <iostream>
00017 using namespace std;
00018
00019
00020 namespace euler
00021 {
00022
00023 void solid_t :: print_off_file(std::ostream& os) const
00024 {
00025 os << "4OFF\n";
00026 int nvertices = 0, nfaces = 0;
00027
00028 for(vertex_t* vtx = vfirst; vtx; vtx=vtx->nxt) nvertices++;
00029 for(face_t* fac = f; fac; fac=fac->nxt) nfaces++;
00030
00031 os << nvertices << ' ' << nfaces << ' ' << 0 << endl;
00032
00033 for(vertex_t* vtx = vfirst; vtx; vtx=vtx->nxt)
00034 os << vtx->p[0] << '\t' << vtx->p[1] << '\t' << vtx->p[2] << '\t' << vtx->p[3] << "\t #" << vtx->id << endl;
00035
00036 os << endl << endl;
00037
00038 for(face_t* fac = f; fac; fac=fac->nxt)
00039 {
00040 int nvertices = fac->l->total_vertices();
00041 os << nvertices << '\t';
00042 edge_t *e = fac->l->e, *e0 = e;
00043 do
00044 {
00045 os << e->v->id << ' ';
00046 }
00047 while( (e=e->nxt) != e0 );
00048 os << endl;
00049 }
00050 }
00051
00052
00053
00054
00055 }