#include "meshutil.h" #include "getvalue.h" void MeshExporter::write(ostream &file, const Array &pts, const LinkedList &poly, const Array &ptsdata) { LinkedList > apoly; LinkedListFixedVector_to_LinkedListArray(&apoly,poly); write(file,pts,apoly,ptsdata); } void MeshExporter::write(ostream &file, const Array > &pts, const LinkedList > &poly, const Array &ptsdata) { Array fpts; ArrayArray_to_ArrayFixedVector(&fpts,pts); write(file,fpts,poly,ptsdata); } void VTKMeshExporter::write(ostream &file, const Array &pts, const LinkedList > &poly, const Array &ptsdata) { if (pts.get_size()==0 || poly.get_size()==0) return; file << "# vtk DataFile Version 3.0" << endl; file << "vtk output" << endl; file << "ASCII" << endl; file << "DATASET POLYDATA" << endl; file << "POINTS " << pts.get_size() << " float" << endl; for (int p=0; p > t(poly); int polytype=t->get_size(); if (polytype==2) { file << "LINES "; } else { file << "POLYGONS "; } file << poly.get_size() << " " << poly.get_size()*(polytype+1) <get_size(); for (int i=0; iget_size(); i++) { file << " " << (*t)(i); } file << endl; } if (ptsdata.get_size()>0) { file << "POINT_DATA " << pts.get_size() << endl; file << "SCALARS mycolor float 1" << endl; file << "LOOKUP_TABLE default" << endl; for (int p=0; p *GenericPlugIn::list=NULL; SpecificPlugIn VTKPlugIn("vtk"); void combine_mesh(LinkedList *ppts, LinkedList > *ppoly, const Array &newpts, const LinkedList > &newpoly) { int shift=ppts->get_size(); LinkedListIterator > it(newpoly); for (; it; it++) { Array *p=new Array(*it); (*ppoly) << p; for (int i=0; iget_size(); i++) { (*p)(i)+=shift; } } (*ppts) << newpts; } void transform(Array *ptpts, const Array pts, const rMatrix3d &op, const rVector3d &trans) { ptpts->resize(pts.get_size()); for (int i=0; i> charwidth(c); get_string(&dummy,file," "); int numpts; file >> numpts; charpts(c).resize(numpts); for (int i=0; i> charpts(c)(i); } get_string(&dummy,file," "); int numpoly; file >> numpoly; for (int i=0; i *ppoly=new Array(); file >> (*ppoly); charpoly(c) << ppoly; } get_string(&dummy,file,"\n"); } charwidth(' ')=0.5; } void PolyFont3D::write(LinkedList *plistpts, LinkedList > *plistpoly, const rVector3d &where, const rVector3d &right, const rVector3d &up, char *string) { rMatrix3d rot; rot.set_column(0,right); rot.set_column(1,up); rot.set_column(2,right^up); rVector3d t(where); for (int i=0; i tpts; transform(&tpts,charpts(c),rot,t); combine_mesh(plistpts,plistpoly,tpts,charpoly(c)); t+=right*(charwidth(c)+spacing); } } Real PolyFont3D::get_length(char *string, int includelast) { Real len=0; for (int i=0; i