/// @brief dumps @ref maze::gcells and @ref maze::cells via rects to PostScript
static void
-psdump (cell* gcells, int n_gcells, boxf BB, boxf* rects, int nrect)
-{
- int i;
+psdump(cell *gcells, int n_gcells, boxf BB, boxf *rects, size_t nrect) {
boxf bb;
box absbb;
fprintf (stderr, "%f %f translate\n", 10-BB.LL.x, 10-BB.LL.y);
fputs ("0 0 1 setrgbcolor\n", stderr);
- for (i = 0; i < n_gcells; i++) {
+ for (int i = 0; i < n_gcells; i++) {
bb = gcells[i].bb;
fprintf (stderr, "%f %f %f %f node\n", bb.LL.x, bb.LL.y, bb.UR.x, bb.UR.y);
}
fputs ("0 0 0 setrgbcolor\n", stderr);
- for (i = 0; i < nrect; i++) {
+ for (size_t i = 0; i < nrect; i++) {
bb = rects[i];
fprintf (stderr, "%f %f %f %f cell\n", bb.LL.x, bb.LL.y, bb.UR.x, bb.UR.y);
}
node_t* n;
maze* mp = gv_alloc(sizeof(maze));
boxf* rects;
- int i, nrect;
cell* cp;
double w2, h2;
boxf bb, BB;
BB.LL.y -= MARGIN;
BB.UR.x += MARGIN;
BB.UR.y += MARGIN;
+ size_t nrect;
rects = partition (mp->gcells, mp->ngcells, &nrect, BB);
#ifdef DEBUG
#endif
mp->cells = gv_calloc(nrect, sizeof(cell));
mp->ncells = nrect;
- for (i = 0; i < nrect; i++) {
+ for (size_t i = 0; i < nrect; i++) {
mp->cells[i].bb = rects[i];
}
free (rects);
}
#endif
-boxf*
-partition (cell* cells, int ncells, int* nrects, boxf bb)
-{
+boxf *partition(cell *cells, int ncells, size_t *nrects, boxf bb) {
int nsegs = 4*(ncells+1);
segment_t* segs = gv_calloc(nsegs + 1, sizeof(segment_t));
int* permute = gv_calloc(nsegs + 1, sizeof(int));
#pragma once
#include <ortho/maze.h>
+#include <stddef.h>
/**
* @brief partitions space around cells (nodes) into rectangular tiles
* @returns array of the tiles
*/
-boxf* partition(cell* cells, int ncells, int* nrects, boxf bb);
+boxf *partition(cell *cells, int ncells, size_t *nrects, boxf bb);