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

optimize walking of L-path vertices #300

Merged
merged 5 commits into from
Oct 24, 2024
Merged

Conversation

bobnik
Copy link
Collaborator

@bobnik bobnik commented Oct 12, 2024

Fixes #176.

Uses a modified shortest path algorithm to avoid re-walking edges that have already been walked. It does add computation time, so the subtype configuration enabled this optimization only if it helps the shape (reduces vertices) and doesn't bog down the browser.

@bobnik bobnik changed the title Fix/176 penrose unoptimized optimize walking of L-path vertices Oct 12, 2024
const node1 = nodes[i]
const node2 = nodes[i + 1]
graph.addNode(node1)
graph.addNode(node2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter that you're adding both nodes each time? You would have to handle the edge case if you didn't do it this way, but it would save almost half the work on large lists of nodes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter that you're adding both nodes each time? You would have to handle the edge case if you didn't do it this way, but it would save almost half the work on large lists of nodes.

You're right. addNode handles it, but that's sloppy and I'll fix.

@jeffeb3
Copy link
Owner

jeffeb3 commented Oct 15, 2024

I am pretty sure 176 was referring to the Space Filler Wiper pattern, which is in space_filler/SpaceFiller.js. That doesn't appear to be affected by this change.

@bobnik
Copy link
Collaborator Author

bobnik commented Oct 15, 2024

I am pretty sure 176 was referring to the Space Filler Wiper pattern, which is in space_filler/SpaceFiller.js. That doesn't appear to be affected by this change.

Click the link on 176 above. It's the penrose optimization issue.

@jeffeb3
Copy link
Owner

jeffeb3 commented Oct 15, 2024

Penrose tile space filler

If you Create New Layer -> Space Filler -> Type: There is a penrose tile there. I think that is what they are referring to. It's in space_filler.js

@bobnik
Copy link
Collaborator Author

bobnik commented Oct 16, 2024

If you Create New Layer -> Space Filler -> Type: There is a penrose tile there. I think that is what they are referring to. It's in space_filler.js

@jeffeb3 Wow, I both missed this and misunderstood your comment. I've added in both places. I had to reduce the maxIterations for Penrose by 1 because the optimization takes too long to run, but it does reduce the vertex count considerably.

@jeffeb3 jeffeb3 merged commit ce1e2a0 into master Oct 24, 2024
2 checks passed
@jeffeb3 jeffeb3 deleted the fix/176-penrose-unoptimized branch October 24, 2024 16:29
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.

Penrose tile space filler highly unoptimized
2 participants