67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
#ifndef VOXELSPACE_H
|
|
#define VOXELSPACE_H
|
|
|
|
#include <vector>
|
|
#include "lib/djstdlib/core.h"
|
|
|
|
constexpr int NUM_ROTS_3D = 24;
|
|
|
|
struct Extrema {
|
|
int xMax;
|
|
int xMin;
|
|
int yMax;
|
|
int yMin;
|
|
int zMax;
|
|
int zMin;
|
|
};
|
|
|
|
struct Space {
|
|
uint64 space;
|
|
int dim_x;
|
|
int dim_y;
|
|
int dim_z;
|
|
};
|
|
|
|
int newIndexRotX(Space *space, int x, int y, int z);
|
|
|
|
int newIndexRotY(Space *space, int x, int y, int z);
|
|
|
|
int newIndexRotZ(Space *space, int x, int y, int z);
|
|
|
|
uint64 toggle(uint64 space, int index);
|
|
|
|
uint64 set(uint64 space, int index, bool val);
|
|
|
|
bool collides(Space *a, Space *b);
|
|
bool collides(uint64 a, uint64 b);
|
|
|
|
Space add(Space *a, Space *b);
|
|
|
|
bool filledAt(Space *space, int x, int y, int z);
|
|
|
|
Extrema getExtrema(Space *space);
|
|
|
|
void cullEmptySpace(Space *space);
|
|
|
|
bool isMatch(Space *a, Space *b);
|
|
|
|
void rotate90X(Space *space);
|
|
|
|
void rotate90Y(Space *space);
|
|
|
|
void rotate90Z(Space *space);
|
|
|
|
void pushNewUniqueSpins(std::vector<Space> *existingSpaces, Space* spaceToSpin);
|
|
|
|
list<Space> getUniqueRotations(Arena *arena, Space *space);
|
|
|
|
list<Space> getAllRotations(Arena *arena, Space *space);
|
|
|
|
list<uint64> getAllPositionsInPrism(Arena *arena, Space *space, int prism_dims[3]);
|
|
|
|
list<uint64> getAllPermutationsInPrism(Arena *arena, Space *space, int prism_dims[3]);
|
|
|
|
int size(uint64 space);
|
|
|
|
#endif
|