Open drewish opened 7 years ago
@simongeilfus has just released a Cinder block which adds support for half-edges. I haven't checked it out myself, but I think it makes sense to use a similar approach here: instead of adding more methods to existing classes, add algorithms that can operate on any set of 2D or 3D vertices. With that being said, just adding methods to PolyLine
might be a good first step.
Interesting, I'm using a couple of different CGAL packages which have half edge structures (Arrangement_2, Straight Skeleton, Polygon_2) with different kernels so I end up going between them and the screen using PolyLine2. So having some code to make the transformations out of PolyLine2 less tedious would be handy.
I find myself continually having to iterate over PolyLines as edges rather than vertexes. I usually end up with some code along the lines of:
Or
I think it'd be great if the PolyLine class had a similar method or an EdgeIterator that would let me step through the points in pairs and handle the isClosed check for me.
I'm happy to open a PR and take a swing at this but I'd love input on the best pattern to follow.