Tools for working with Polygons and Polypaths in vvvv gamma.
Polygon = shape made only of lines, Polypath = shape made of lines and curves
See the helppatches for a more detailed overview
To Install
Grey menu (top left)>Manage Nugets>Command Line
Type nuget install VL.PolyTools
What kind of things does it do?
Interactive Helppatches
Visibility from a point inside a polygon
(Using Expanding Triangles method by Francisc Bungiu, Michael Hemmer, John Hershberger, Kan Huang and Alexander KrΓΆller)
3D extrusion of Polygons in stride
Union of PolyPaths including internal compartment lines.
Cutting a Polypath into compartments.
Bonus see included βSKPathUtils.vlβ if you are looking for some low level SKPath verb methods.
i hacked together some of the stuff you got in here for my generative lasercutting/3d printing/papercutting stuff, but it was always hacky and not consistent. will try to redo my patches with your library and report back.
Now updated to 1.0.3
-Helppatch improvements
-Consistent GetBounds method for Polygon and PolyPath
-Added Splitting Circles Example patch kindly contributed by ββ ββ
-Added option to Compartments operation to avoid including outer stroke
@tobyk
I confirm, the error does not reproduce. Now everything starts normally.
But it was a steady result after restarting Gamma for a while. I donβt know what changed.
βhow to extrude a polypath in 3dβ contains an obsolete version of βextruded polygon.β
βhow to render a polypath plane in 3dβ is missing the βpolygonPlaneβ
I did not look through all the help patches (yet) but thankβs lot for sharing! This is quite extensive, and especially the distance and intersection tools are pretty cool. snap on path, nearest pointβ¦ those will be really fun to use!
Yes but I think it makes sense in VL.Polytools as a collection of functions that build on skia and make solving geometric problems easier. Itβs also much easier for me to just include it then to mess about with a pull request to VL.Skia (If itβs even on github?)
@tobyk Can you suggest a way to get an array of points used to build a polygon / polypath? I am a bit stuck and canβt figure out how to get this action done
Like this?
Maybe thereβs a way of sampling it? I would even try to sample only the curved parts.
It looks like this array of points contains the control points of the bezier
The data inside a polygon is the list of points that make a shape with straight edges. So this list also simply describes the outline of the shape.
The data inside a polypath is indeed the control points. For straight sections will be equivalent to polygon but for curves they are bezier type control points (although possibly one of the verbs is not bezier, donβt remember. In any case itβs control points)
So you got the right idea already: to get a list of points from a polypath that is the outside shape you must sample the curves and βflattenβ it into a polygon. You can see there is trade offs here with resolution and losing the vector information.
Iβm not near a laptop to find the exact nodes but I think they are in the helppatch βconvert a polypath to a polygonβ