/* Cross-section input/output. */ /* Last edited on 2015-10-18 02:41:13 by stolfilocal */ #ifndef salamic_section_write_H #define salamic_section_write_H #define _GNU_SOURCE #include #include #include #include void salamic_section_write_section_header(FILE *wr, stmesh_t mesh, int32_t pZ, uint32_t mf); /* Writes to {wr} the header of a file that contains a cross-section {mesh} by a slicing plane with quantized {Z}-coordinate {pZ}. Assumes that the slicing plane intersects a total of {mf} faces. */ void salamic_section_write_path_or_loop(FILE *wr, stmesh_t mesh, int32_t pZ, uint32_t me, stmesh_edge_t e[]); /* Writes to {wr} an open or closed path that is part of a cross-section defined by {mesh,pZ}. Assumes that the vertices of the path are the intersections of the slicing plane with the edges {e[0..me-1]}. The path is assumed to be closed if and only if {e[0] == e[me-1]}. */ #define salamic_section_VERSION "2015-09-30" /* Current version of cross-section file format. */ #define salamic_section_format_INFO \ "The file for each cross-section starts with a preamble\n" \ "\n" \ " begin salamic_section (format of " salamic_section_VERSION ")\n" \ " eps = {EPS}\n" \ " planeZ = {PLANEZ}\n" \ " planeQ = {PLANEQ}\n" \ " nSegs = {NSEGS}\n" \ "\n" \ " and ends with with the file footer line\n" \ "\n" \ " end salamic_section\n" \ "\n" \ " The parameter {EPS} is the fundamental unit of length used in the" \ " quantization of the mesh (in mm); {PLANEZ} is the {Z}-coordinate" \ " of the slicing plane (in mm); {PLANEQ} is the integer {PLANEZ/EPS}; and" \ " {NSEGS} is the total number of line segments in the cross-section.\n" \ "\n" \ " Between the file header and footer there are zero or more blocks of lines, one" \ " for each separate polygonal line found by the loop closing algorithm. Each" \ " block starts with the path header lines\n" \ "\n" \ " path \n" \ " nPoints = {NV} \n" \ "\n" \ " and ends with with the path footer line\n" \ "\n" \ " end path\n" \ "\n" \ " In between the path header and footer are the {X} and {Y} coordinates" \ " of the {NV} path vertices, in millimeters and separated by blanks, one" \ " vertex per line. The path can be assumed to be" \ " closed if the last vertex is equal to the first one. Note that a" \ " polygon with {NS} sides, open or closed, will have {NV = NS+1}." void salamic_section_write_section_footer(FILE *wr); /* Writes to {wr} the footer of a file that contains a mesh cross-section. */ #endif