Shape2d object returned by a
svg::DocRef doesn’t contain valid
Path2d objects, because the contours inside don’t start with a
MOVETO segment. This in turn causes the
reverse() function call on the
Path2d objects to mess them up, as it always expects a
MOVETO segment in the beginning.
I’ve tried a few fixes (as elaborated below) but still don’t know how to…
As per a previous topic of mine, I’m working with
Shape2d objects generated via a
svg::DocRef and attempting to extrude the vector shapes to generate a simple derived model with some depth.
The winding order of the points obtained in the
Path2d objects contained within the
Shape2d object are not always clock-wise. Even if they were, they might not be after I have performed some transformations on them. Therefore it becomes quite helpful to determine the winding order which the other post explores.
Once the winding order has been determined I call (or do not call)
reverse() on the various
Path2d objects. It seems generate ‘bad’
Path2d objects however, as they don’t begin with a
MOVETO segment. This doesn’t seem to bother the
geom::extrude function however, but it does cause the
reverse() function to severely alter the
reverse() function always expects a path to begin with a
MOVETO segment and so will reverse all the points, but only some of the segments.
I thought a quick fix might be to simply manually insert a
MOVETO segment in front of every
Path2d I get out of the
Shape2d object that I get from the
svg::DocRef object. But either I’m not doing this correctly or I’m missing something as I’ve only managed to create new
Path2d objects that cause
geom::extrude to throw an exception I’ve yet to delve into deeper.
So I guess my question is one of two. Either:
- Does someone have a fix for the code in Cinder to have the
Path2dobjects inside the
- Failing that, does anyone have any advice on how to safely add a
MOVETOsegment at the beginning of any
Path2d? I’ve tried simply cloning the very first point at the start and inserting a new
MOVETOsegment along with it, but that doesn’t seem to go well. The
Path2dobject confuses me a bit as well, as the
moveTofunctions don’t seem to automatically add a
mSegmentslike all the other similar functions.
Any thoughts are appreciated!