From 6fa9ed77f6e124691e588bdb70f21d3aa10f30e8 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Wed, 30 Oct 2024 09:51:04 -0400 Subject: create collision buffers --- partition.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'partition.c') diff --git a/partition.c b/partition.c index 354e033..b7229d6 100644 --- a/partition.c +++ b/partition.c @@ -1,4 +1,5 @@ #include +#include #include "sysfatal.h" #include "balls.h" @@ -52,6 +53,19 @@ freePartition(Partition part) { free(part.cells); } +void +printPartition(Partition part) { + size_t i, j; + + for (i = 0; i < part.size; i++) { + printf("{"); + for (j = 0; j < part.cells[i].size; j++) + printf("(%lu, %lu), ", part.cells[i].ballIndices[j][0], + part.cells[i].ballIndices[j][1]); + printf("}\n"); + } +} + /* Allocate an empty partition. Partition should be freed by the caller after use. */ static Partition newPartition(void) { -- cgit v1.2.3