#ifndef Pov_H #define Pov_H /* Last edited on 2007-01-25 10:40:52 by stolfi */ /* Common procedures for POVray output. */ #define Pov_H_copyright \ "Copyright © 2000 Universidade Estadual de Campinas (UNICAMP)" #define Pov_H_author \ "Created by L. P. Lozada, UNICAMP, 2000" \ "Based on tools by R.M.Rosi and J.Stolfi, UNICAMP, 199???" #include #include #define _GNU_SOURCE #include void WritePOVCoord(FILE *wr, double c); /* Writes a point coordinate in POVray format. */ void WritePOVPoint(FILE *wr, r3_t *p); /* Writes a 3D point in POVray format. */ void WritePOVColor(FILE *wr, frgb_t *cr); /* Writes a rgb color in POVray format. */ void WritePOVColorTransp(FILE *wr, frgb_t *cr, float tr, bool_t filter); /* Writes a rgb color with transparency {tr} in POVray format. */ void WritePOVCylinder ( FILE *wr, r3_t *o, r3_t *d, float radius, frgb_t *cr, float tr, bool_t filter, char *tag1 /* DF "" */, char *tag2 /* DF "" */ ); /* Defines a finite length cylinder without parallel end caps.*/ void WritePOVSphere ( FILE *wr, r3_t *p, float radius, frgb_t *cr, float tr, bool_t filter, char *tag1 /* DF "" */, char *tag2 /* DF "" */ ); /* Defines a sphere with center in {p} and radius {radius}. POVray has a highly optimized sphere primitive which renders much more quickly that the corresponding polynomial quadric shape. */ void WritePOVTriangle ( FILE *wr, r3_t *a, r3_t *b, r3_t *c, frgb_t *cr, float tr, bool_t filter, char *tag1 /* DF "" */, char *tag2 /* DF "" */ ); /* Defines a triangle. Because triangle are perfectly flat surfaces it would requiere extremely large numbers of very smal triangles to appro- ximate a smooth, curved surface. */ void WritePOVTriangleTex ( FILE *wr, r3_t *a, r3_t *b, r3_t *c, char *texture ); /* Defines a triangle as above but with a some predefined texture. */ void WritePOVSmoothTriangle ( FILE *wr, r3_t *a, r3_t *an, r3_t *b, r3_t *bn, r3_t *c, r3_t *cn, frgb_t *cr, float tr, bool_t filter ); /* Much of our perception of smooth surfaces is dependent upon the way ligth and shading is done. By artificially modifying the surface normals we can simulate a triangle to be a smooth curved surface. The SmoothTriangle primitive used the phong shading or interpolation of normals to calculate the surface normal for any point on the triangle based on normal vectors which you define for the three corners. These normal vectors are prohibitivily difficult to computed by hand. Therefore smoothtriangles are almost always generated by utility programs. */ void WritePOVSquare ( FILE *wr, r3_t *a, r3_t *b, r3_t *c, r3_t *d, frgb_t *cr, float tr, bool_t filter ); /* Outputs a square formed by the union of two triangular walls, adjacent to one common edge. /\ d / \ a /____\ c \ / \ / b \/ */ void WritePOVTetrahedron ( FILE *wr, r3_t *u, r3_t *v, r3_t *w, r3_t *x, double du, double dv, double dw, double dx, frgb_t *cr, float tr, bool_t filter ); /* Builds a tetrahedron by the union of four triangular walls. to one common edge. v /|\ / | \ x /__|__\ w \ | / \ | / \|/ u */ void WritePOVPenta ( FILE *wr, r3_t *a, r3_t *b, r3_t *c, r3_t *d, r3_t *e, frgb_t *cr, float tr, bool_t filter ); /* Define a pentagon build by the union of three triangular walls, adjacent to edge to one common edge. .b / \ c /___\a | /| | / | |/__| d e */ #endif