export_dxf.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004                                                \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 /****************************************************************************
00024   History
00025 
00026 $Log: not supported by cvs2svn $
00027 Revision 1.4  2005/02/03 11:22:34  spinelli
00028 ricorretti i metodi save per rendere compatibile il formato dxf con il formato di autocad specificato nel dxf reference 2005
00029 
00030 Revision 1.3  2004/07/02 17:08:12  ganovelli
00031 created
00032 
00033 Revision 1.2  2004/06/10 15:15:16  ganovelli
00034 changes to comply dxf specs
00035 
00036 Revision 1.1  2004/05/27 13:24:08  ganovelli
00037 export_dxf created
00038 
00039 ****************************************************************************/
00040 #ifndef __VCG_LIB_EXPORTER_DXF
00041 #define __VCG_LIB_EXPORTER_DXF
00042 
00043 
00044 namespace vcg {
00045         namespace edg {
00046                 namespace io {
00047 
00048 
00049 template <class EdgeMeshType>
00050 class ExporterDXF
00051 {
00052 public:
00053 
00054         ExporterDXF(void){}
00055 
00056         
00057 
00058         static bool Save(EdgeMeshType  *mp, const char * filename)
00059         {
00060                 FILE * o = fopen(filename,"w");
00061                 if(o==NULL)     return false;
00062                 fprintf(o,"0\n");
00063                 fprintf(o,"SECTION\n");
00064                 fprintf(o,"2\n");
00065                 fprintf(o,"ENTITIES\n");
00066 
00067                 Save(mp,o);
00068 
00069                 fprintf(o,"0\n");
00070                 fprintf(o,"ENDSEC\n");
00071                 fprintf(o,"0\n");
00072                 fprintf(o,"EOF\n");
00073                 fclose(o);
00074                 return true;
00075         }
00076 
00077 
00078 
00079         static void Save(EdgeMeshType *mp, FILE* o )
00080         {
00081                 typename EdgeMeshType::EdgeIterator i;
00082                 for(i=mp->edges.begin(); i!=mp->edges.end();++i)
00083                 {
00084                         Point3f p1 = (*i).V(0)->P();
00085                         Point3f p2 = (*i).V(1)->P();
00086 
00087 
00088                         fprintf(o,"0\n");  
00089                         fprintf(o,"LINE\n");
00090                         fprintf(o,"8\n");  
00091                         fprintf(o,"0\n");       
00092                         fprintf(o,"10\n"); 
00093 
00094                         fprintf(o,"%f\n", p1[0]);     //X
00095                         fprintf(o,"20\n"); 
00096                         fprintf(o,"%f\n", p1[1]);     //Y
00097                         fprintf(o,"30\n");  
00098                         fprintf(o,"%f\n", p1[2]);     //Z
00099 
00100                         fprintf(o,"11\n");
00101                         fprintf(o,"%f\n", p2[0]);     //X
00102                         fprintf(o,"21\n"); 
00103                         fprintf(o,"%f\n", p2[1]);     //Y
00104                         fprintf(o,"31\n"); 
00105                         fprintf(o,"%f\n", p2[2]);     //Z
00106 
00107                 }
00108 
00109 
00110 
00111         }
00112 
00113 
00114 };
00115 
00116                 };
00117         };
00118 };
00119 #endif


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:30:49