louis-langholtz / PlayRho

An interactive physics engine & library.
zlib License
128 stars 24 forks source link

No CSG For 2-D shape modeling #276

Open louis-langholtz opened 6 years ago

louis-langholtz commented 6 years ago

Expected/Desired Behavior or Experience:

Ability to create complex 2-D shapes by using boolean operators (union, intersection, and difference) to combine simpler shapes. Basically Constructive Solid Geometry (CSG) for 2-D shapes. The resulting shape should be a MultiShapeConf structure (which can take on any convex or concave shape).

Actual Behavior:

Nothing like this is already available as part of the PlayRho library.

Related Issue(s):

Hexlord commented 6 years ago

@louis-langholtz do you mind carrying over a dependency like Clipper lib (170kb) ?

louis-langholtz commented 6 years ago

@Hexlord Is the license compatible? I think so but I'm not certain (so I'm asking).

I guess the answer to this question depends to on how the project would use any dependency. Dependencies for the library seem harder to deal with than dependencies for components (like the Testbed) that depend on the library.

Note that originally I'd been thinking users would just pull in clipping libraries or whatever they used for their applications and then use the clipped results to construct their PlayRho shapes with. Would that be a better starting objective?

When I opened this issue, I was at the point though of implementing identified/chosen clipping algorithms directly within the PlayRho library framework. I.e. so that it was all done, the operations would be available from the playrho namespace (or playrho::d2 namespace). On thinking about this more since then, I suspect some of the Shape design will need to be modified so that at least the vertex radius property is per child (not per shape).

Note that I'm about to push some related changes to the Shape code. Would it be worthwhile to wait till I get that pull request submitted?

Hexlord commented 6 years ago

I would prefer it to be PlayRho extension dependent on 3rdparty library for TestBed usage (wrapped by PlayRho namespace for usage). But it would probably be more easy to use directly within playrho source, yet I don't like the idea of replicating excisting alghorithms when the original lirary is opensource copyrighted and very small, seems pointless.

louis-langholtz commented 6 years ago

Thanks Hexlord. Sounds like we have a similar perspective of the pros and cons. I'm excited to see what you come up with. Sorry that I haven't gotten the changes I've had in mind for the Shape class done yet (these are done now). If you can get free functions working to interface with the code you use and the existing shape code that would give us a starting point. If there's way to make small steps in this towards the end goal that may useful to do that way. I am open to some changes to the Shape code to help this if needed.