Open Wagyx opened 1 year ago
Hi Wagyx,
The point_rotations_lut has a few more intricacies to it - especially if you aren't generating all rotations. Looking at the logic of "generator_create_rotations" in generator.c, note how the computed rotations depend on the dimensions of the seed polycube. Still, this is just a guess at the cause in your case because there are a number of other factors. To test if this is the only factor, you can temporarily replace the dimension checking code and directly compute all rotations.
Note each row of the point_rotations_lut should always include each dimensional component in some order - either as the base component (X,Y,Z = 0,1,2 in 3D) or its reflection (X',Y',Z' = 3,4,5 in 3D). The 3D case is ordered such that the first component / reflection corresponds to the chosen computed rotations in "generator_create_rotations". I further narrowed the 3D case with the second component meaning something if all 3 dimensions were different, though I don't recall it helped performance as much.
Assuming base components (X,Y = 0,1 in 2D) and reflections (X',Y' = 2,3 in 2D), I think the point_rotations_lut for the 2D case should be:
{0,1}, // X
{2,3},
{1,2}, // Y
{3,0}
My suggestion would be to start debugging back at the "generator_generate" function. Construct the point list key programmatically in a test main.c file and read out the output points of the "rkeys" to see if it matches your expectations. This is where I started when building the project. The result should return duplicate polycubes, but the duplicates should always appear in the same orientation.
Other considerations:
Thank you for your detailed answer.
I have managed to fix my code. It computes all the rotations for now but it works. I have made a branch on your forked repo here I have also made an online viewer similar to the polycube viewer. Here is the repo.
The 4D case will need a lot more thoughts and considerations for sure.
Hello snowmanam2, I have forked your project and started a new branch where I am trying to modify the code so it could generate the 2D polyominoes but I am struggling with something, probably the rotation part. I have changed lut to
const uint8_t point_rotations_lut[][2] = { {0,1}, {0,3}, {2,3}, {2,1} }
but the numbers I get do not follow the enumeration from Kevin Gong Could you develop a bit on that. There may be a mistake at another place in the code though. I also wonder what to change to make it work with higher dimensions. Thank you,