VL.PolyTools

VL.PolyTools

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?

image

Interactive Helppatches

VL PolyTools FOV Calc

Visibility from a point inside a polygon
(Using Expanding Triangles method by Francisc Bungiu, Michael Hemmer, John Hershberger, Kan Huang and Alexander Kröller)

VL PolyTools 3D Extrude

3D extrusion of Polygons in stride

VL PolyTools Polypath Union

Union of PolyPaths including internal compartment lines.

VL.PolyTools Cutting A Poly into Compartments

Cutting a Polypath into compartments.

Bonus see included ‘SKPathUtils.vl’ if you are looking for some low level SKPath verb methods.

Dependencies

Made with vvvv Gamma 2021.4.10

com.angusj.Clipper -Version 6.4.2

credit Angus Johnson, gylee

LibTessDotNet

credit Contributors to speps/LibTessDotNet · GitHub

Special Thanks

@Untone for help unlocking the SKPath verbs for use in vvvv gamma

License

Boost 1.0

19 Likes

Thanks so much for this!

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.

2 Likes

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

2 Likes

for some reason exception raises in 2022.5 280 preview

@Yar afraid I cannot reproduce.
Those helppatches all working for me in Polytools V1.0.3 on
2022.5.0 280.

@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.

@Yar
Ok. noted. I’ll do a more thorough test of all the helppatches when 2022.5 goes to release candidate.

Fantastic contribution and nicely structured help patches!
Tested with 2022.5 preview 310

image
It also works with STRG+ to create multiple input pins!


^^

“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!

2 Likes

Hi @tobyk
I have a feature suggestion
It would be great to add Keep Tool functionality if it would needed to left one of the paths in output

изображение

1 Like

@yar

Ok, I’ll make a note to include that as a utility op in the next major update (Probably when 2022.5 goes RC)

Nice! Thank you
Maybe, just for consistency, would be great add “both” option

I just realized that these are Skia nodes, not polytool, right?

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 Make sense!

look what I made recently:

Images

изображение

изображение

изображение

4 Likes

Wow super impressive!

Very compelling look

@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

@yar

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’

Thank you! I’ll have a look

So far I have solved this problem as follows

изображение

But it is much easier:

1 Like