Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing with cube rotations #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

GomideLeo
Copy link

Created a signature for each polycube in a rotation set so that it is possible to consistently choose the same rotation(s) if different polycube orientations of the same polycube are given. Two orientations might have the same signature, and will both be considered in this case.

Also, when a cube is symetric in one or more axes, the all_rotations function would return all of those rotations, added a way to prevent those

@bertie2
Copy link
Collaborator

bertie2 commented Jul 12, 2023

this is cool and does seem to reduce the number of comparisons needed, unfortunately comparisons are fast, and the math you are doing to work out which to remove is slow, so this actually results in a dramatic slow down of the code, example:

you are very right that rotating symmetric objects, and trying all the rotations is a waste of time, but we need to find a a way to remove these wastes which doesn't have too high a linear time cost.

Benchmark Examples (absolute values are hardware dependent and irrelevant, but the ratio is important):

pullrequests\opencubes> python .\cubes.py --no-cache 8
Generating polycubes n=3: 100%
Generating polycubes n=4: 100%
Generating polycubes n=5: 100%
Generating polycubes n=6: 100%
Generating polycubes n=7: 100%
Generating polycubes n=8: 100%
Found 6922 unique polycubes
Elapsed time: 18.167s

pullrequests\openCubesThing> python .\cubes.py --no-cache 8
Generating polycubes n=3: 100%
Generating polycubes n=4: 100%
Generating polycubes n=5: 100%
Generating polycubes n=6: 100%
Generating polycubes n=7: 100%
Generating polycubes n=8: 100%
Found 6922 unique polycubes
Elapsed time: 125.612s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants