/* Cross-section input/output. */ /* Last edited on 2015-10-01 20:13:07 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, salamic_mesh_t *mesh, int32_t pZ, int32_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, salamic_mesh_t *mesh, int32_t pZ, int32_t me, int32_t ixEdge[]); /* 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 {ixEdge[0..me-1]}. The path is assumed to be closed if and only if {ixEdge[0] == ixEdge[me-1]}. */ #define salamic_section_VERSION "2015-09-30" /* Current version of cross-section file format. */ #define salamic_section_format_INFO \ "The file for one 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" \ " where {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. The" \ " whole file ends with a one-line footer, \"end salamic_section\".\n" \ "\n" \ " Between the header and the 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 a line \"path {NV}\", where {NV} is the number of vertices" \ " on the path, and ends with an \"endpath\" line. In between are the corodinates" \ " of the path vertices, one per line, in mm. The path can be assumed to be" \ " closed if the last vertex is equal to the first one." void salamic_section_write_section_footer(FILE *wr); /* Writes to {wr} the footer of a file that contains a mesh cross-section. */ #endif