Skip to content
This repository has been archived by the owner on Nov 8, 2017. It is now read-only.

Consider using Clipper library instead of geometry/pathfinder.coffee #11

Open
jarek-foksa opened this issue Jan 25, 2014 · 3 comments
Open

Comments

@jarek-foksa
Copy link

Path clipping is a tough mathematical problem that requires some non-trivial code. Instead of trying to do it yourself I would use JavaScript Clipper [1] library. Clipper doesn't have full support for Beziers yet (it's being worked on in the upstream branch, for now you would need to convert beziers to polygons), though it would be much more reliable than the current code in geometry/pathfinder.coffee.

[1] http://sourceforge.net/projects/jsclipper/

@artursapek
Copy link
Owner

Pathfinder was the bit that I was still working on when I decided to open this project up. It's not available through the UI yet because it's so unfinished. In fact it should be on a seperate feature branch.

It's been by far the hardest part of building Mondrian. That also means it's the most interesting, so I definitely want to have a native pathfinder implementation in the codebase. I think having a pathfinder utility would be great, but it's not a top priority right now so I'm not in a hurry to get it out.

For the time being I'll check out clipper. If it's not too hard to get it to work in a way that feels "native" I'll consider merging something temporary in, but if it doesn't support beziers yet then I don't think there's much of a chance. Thanks for the suggestion.

@wraybowling
Copy link

Paper JS had similar woes but later on they merged in another boolean library's functions that were really great. It was an interesting read when it happened. I'm having a hard time finding links now, but just sayin' it's out there. Somewhere. (Also, paperjs is on github. So there's that.)—
Sent from Mailbox for iPhone

On Sat, Jan 25, 2014 at 10:01 AM, Artur Sapek [email protected]
wrote:

Pathfinder was the bit that I was still working on when I decided to open this project up. It's not available through the UI yet because it's so unfinished. In fact it should be on a seperate feature branch.
It's been by far the hardest part of building Mondrian. That also means it's the most interesting, so I definitely want to have a native pathfinder implementation in the codebase. I think having a pathfinder utility would be great, but it's not a top priority right now so I'm not in a hurry to get it out.

For the time being I'll check out clipper. If it's not too hard to get it to work in a way that feels "native" I'll consider merging something temporary in, but if it doesn't support beziers yet then I don't think there's much of a chance. Thanks for the suggestion.

Reply to this email directly or view it on GitHub:
#11 (comment)

@artursapek
Copy link
Owner

I have an attack strategy for Pathfinder - I think I have the algorithm worked out on paper. I'm working on visual documentation at artur.co/pathfinder.

I just haven't finished implementing it yet because there were some problems with the implementation of the linked list that stores a path's points. I don't think it's too far off if I focus on it for a while.

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

No branches or pull requests

3 participants