Replies: 7 comments 3 replies
-
I guess I would now replace the int64_t type used for z by another template type, rather than a hardcoded struct... |
Beta Was this translation helpful? Give feedback.
-
Or one could adjust the API to have an arbitrary stride (in bytes) between input points, and an offset for custom data (like OpenGL/Vulkan vertex arrays). The pointer to the custom data is passed to the callback, to build new vertices as desired. It's what I did in my C port, but I haven't merged Angus' bug fixes of the past 2 months, so that's not ideal. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's another way of doing it... |
Beta Was this translation helpful? Give feedback.
-
It was more a rewrite than an update (the offset stuff isn't that much code), but yes (kind of). Every "offseted" point in the new shape comes strictly from a single origin point (it's not interpolated or anything). Look at ClipperOffset::OffsetPoint(); that's where all the points are added (plus OffsetOpenPath() if you care about the ends of open paths). You could add a custom callback whenever points are pushed to the group.path_, probably just to copy the set of custom attributes of the origin point (unless you can look it up somewhere externally, always pass a void *context to callbacks!). The Clipper64 callback to fill custom vertex attributes would be different, as you can actually interpolate between 4 input points there. |
Beta Was this translation helpful? Give feedback.
-
The templating of a |
Beta Was this translation helpful? Give feedback.
-
Yes, the whole memory management would have to be quite different to allow a custom amount of extra per-vertex data (which could be considered eventually, as I did get a 15-ish% performance boost when tweaking memory management). The quick and easy solution is a Z struct (or union, for multiple Z structs), defined at compilation time. |
Beta Was this translation helpful? Give feedback.
-
Please put requests for new features in Discussion, and not in Issues (ref this post). |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm currently evaluating how much work it would be to update our client code that was relying on Clipper1Lib, to use Clipper2Lib.
It seems we modified the initial Clipper1Lib in order to have the offsetter to support a zfill (zcallback) function. Do you have any plan to add that ?
Also, we did another modification, we changed the Z type to a struct (could be a template as well). This allows us to pack multiple things in that (alpha, elevation, etc.), reason why we also needed that z-interpolation callback for the offsetter.
So, I guess these are significant additions, I assume I'll have to port-back into Clipper2Lib - just wanted to check if these additions would be relevant for you (or not).
Cheers,
Greg
Beta Was this translation helpful? Give feedback.
All reactions