diff options
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/tectonics/Makefile | 4 | ||||
-rw-r--r-- | experimental/tectonics/main.c (renamed from experimental/tectonics/tectonics.c) | 2 | ||||
-rw-r--r-- | experimental/tectonics/world.c | 11 |
3 files changed, 8 insertions, 9 deletions
diff --git a/experimental/tectonics/Makefile b/experimental/tectonics/Makefile index a0245f3..13f48fc 100644 --- a/experimental/tectonics/Makefile +++ b/experimental/tectonics/Makefile @@ -5,8 +5,8 @@ DEPS=tectonics.h %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) -all: world.o util.o tectonics.o quadtree.o drawing.o logging.o - $(CC) -o tectonics world.o util.o tectonics.o logging.o quadtree.o drawing.o $(CFLAGS) +all: world.o util.o main.o quadtree.o drawing.o logging.o + $(CC) -o tectonics world.o util.o main.o logging.o quadtree.o drawing.o $(CFLAGS) test: all quadtree.o quadtree.test.o tests.o $(CC) -o tests world.o util.o quadtree.o quadtree.test.o tests.o $(CFLAGS) diff --git a/experimental/tectonics/tectonics.c b/experimental/tectonics/main.c index 0a81b45..93b32fb 100644 --- a/experimental/tectonics/tectonics.c +++ b/experimental/tectonics/main.c @@ -21,7 +21,7 @@ int main(int argc, char **argv) cairo_t *cr = cairo_create(surface); struct world_t world; - create_world(&world, 10000); + create_world(&world, 100000); if (world.points == NULL) return 1; draw_world(cr, &world); diff --git a/experimental/tectonics/world.c b/experimental/tectonics/world.c index f5b6efb..dc042ee 100644 --- a/experimental/tectonics/world.c +++ b/experimental/tectonics/world.c @@ -53,7 +53,6 @@ static void relax_points(struct world_t *world, int iterations) // approximate centroids for (int i=0; i<iterations; i++) { - printf("%02f%%\n", 100*((double)i+1)/iterations); // generate a random point and find the closest // terrain point double x = rand01(); @@ -63,7 +62,7 @@ static void relax_points(struct world_t *world, int iterations) (struct point_t){x, y}); if (closest == -1) { - printf("WARN: bad closest point!\n"); + log_msg(WARN, "bad closest point for (%f, %f)", x, y); } else { // average the centroid towards that random point @@ -109,14 +108,14 @@ void create_world(struct world_t *world, int n_points) struct point_t *pt = world->points + i; pt->x = rand01(); pt->y = rand01(); - - //quadtree_insert(&(world->tree), world->points, i); } rebuild_tree(world); - for (int i=0; i<15; i++) - relax_points(world, 10*world->n_points); + for (int i=0; i<1; i++) { + log_msg(INFO, "relaxing points - iteration %d", i+1); + relax_points(world, 50*world->n_points); + } } |