diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-30 09:51:04 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-30 09:51:04 -0400 |
| commit | 6fa9ed77f6e124691e588bdb70f21d3aa10f30e8 (patch) | |
| tree | 568a438e11ad005fd6bd0a20f5d28d331844a697 /partition.c | |
| parent | ef0ba48ead218d37d979b5ca156ea9d557754dd6 (diff) | |
| download | balls-6fa9ed77f6e124691e588bdb70f21d3aa10f30e8.zip | |
create collision buffers
Diffstat (limited to 'partition.c')
| -rw-r--r-- | partition.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/partition.c b/partition.c index 354e033..b7229d6 100644 --- a/partition.c +++ b/partition.c @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <stdio.h> #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) { |