#ifndef Polygon_H #define Polygon_H /* Last edited on 2007-02-04 16:17:06 by stolfi */ /* Procedures to build isolated {n}-sided polygons. */ #define Polygon_H_copyright \ "Copyright © 2000 Universidade Estadual de Campinas (UNICAMP)" #include #include #include #include Place_vec_t PolygonMake(uint n, bool_t nodes, bool_t edges, bool_t walls, bool_t cells); /* Builds a 3D map on the 3-sphere consisting of an isolated {n}-gon. The map has {n} nodes (vertices, corners) {v[0..n-1]} {n} edges (sides) {e[0..n-1]} 1 wall {f} 1 cell {c} {n} wedges {4*n} places The single cell {c} incides on both sides of the single wall {f}. Edge {e[i]} connects node {v[i]} to node {v[(i+1)%n]}. Returns a vector {pv} where {pv.e[i]} is a place on edge {e[i]}, flowing out of node {v[i]}. Thus {NextE(pv[i]) = pv[(i+1)%n]}. If {nodes} is TRUE, the procedure also creates the node data records and assigns them to the node data slots {OrgV(p)} of the appropriate places. If {nodes} is FALSE, all node slots are set to NULL. The meaning of parameters {edges}, {walls}, and {cells} is analogous. */ Place_t PolygonMakeSng(uint n); /* Same as {MakePolygon(n,TRUE,TRUE,TRUE,TRUE)} but returns only one place {p}. */ void PolygonFixCoords(Place_t p, uint n, Coords_t *c); /* Assigns canonical coordinates to the corners of a wall {f = p.wall}, assumed to have {n} sides. Specifically, for {i} in {0..n-1} assigns to corner {v = OrgV(NextE^i(p))} of {f} the coordinates {{ cos(i*A), sin(i*A), 0, 0}} where {A=2*PI/n}. Assumes that the note pointer {OrgV(q)} is valid for every place {q} on {f}, and that the {num} fields of those nodes have distinct values in the range {0..c->ne-1}. */ #define Polygon_H_author \ "C interface created by J. Stolfi, jan/2007." #endif