!Update 1.3.0 released 30.08.23, see below
If you find VL.PolyTools useful please put a star on it on github
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?
Interactive Helppatches
Polygon Tube
Polygon Tube with normal mapping
Lerp between 2D Polygons in 2D and 3D
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
An extruded Polygon with Normal mapping
Bonus see included ‘SKPathUtils.vl’ if you are looking for low level ways to extend SKPaths
Dependencies
Made with vvvv Gamma 5.3-0088
com.angusj.Clipper -Version 6.4.2
credit Angus Johnson, gylee
LibTessDotNet
Geometry3Sharp
credit Contributors to speps/LibTessDotNet · GitHub
Special Thanks
@Untone for help unlocking the SKPath verbs for use in vvvv gamma
Version History
V1.4.0
- !Breaking Change! Fixed error in the Polygon2DPlus Join method that takes 3D polygon points and a normal
- !Breaking Change! Renamed ‘LineSegmentIntersectsBox’ to just ‘LineIntersectsBox’ to make consistent with similar functions
- Added new function LineIntersectsRectangle and helppatch.
- Fixed bug TransformsOnLine where it didn’t normalise internal direction vector
- Fixed Bug PolyTubeMesh where it would reverse the direction of 2D data but not 3D data.
- Improved debug out data on PolyTubeMesh
- Added new function and helppatch ‘find if points are on a line’
- Added new function and helppatch ‘Interpolate points in a triangle’
- Added new function and helppatch ‘Calculate normal of a line segment 2d’
V1.3.0
- !Breaking Changes! Re-categorisation of some nodes into new Line category. Some line related functions may have red nodes. Double click on them, clear their existing associations in the bottom right and search again for the name and you should find the same nodes.
- !Breaking Change! All polytubes need their input ‘Polygon2DPlus’ types to have heightmode=1 (Y=height). This is now consistent, was 0 on some old helppatches.
- Added 3D Triangle Intersection, see helppatch.
- Exposed RayIntersectsTriangle from Stride.Core.Mathematics
- Added a helppatch for Solving a Triangle in 3D and a node for finding the third point of a triangle if you know some constraints about the first two points.
- Added function for finding a 3D Line segment intersects a box with helppatch
- Added new dependency Geometry3Sharp GitHub - gradientspace/geometry3Sharp: C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.. Currently only using this for a few intersections but has potential to do a lot more in this package. It’s Boost 1.0 licence (like clipper).
- Added LinePoints utility drawing function for stride
- Added Plane (Plane) utility drawing function for stride, this takes a Plane mathematical struct as input, however note this has some limitations as the struct is infinite and we are drawing a finite plane. Basically just make it really big.
- Exposed Normal input on LibTessDotNet Triangulation nodes. Triangulation nodes are 2D but it can be necessary to set the face direction in 3D use. See the CalcTubeEndCaps process inside PolyTubes for an example usecase.
- Improved TransformsOnSpline and TransformOnLine nodeset where you specify either ForwardVectors or a single ForwardVector. See the “Tube On Path” helppatch for an explanation. This is less confusing for their usecases where the UpVector of the Spline/Line is the Y axis, and results in less weird singularity twists in tubes. The previous nodes are still included in obsolete category.
V1.2.2 - Bugfixes with dependencies
V1.2.1
- !Breaking Change! Refactored categories for some of the Polygon3D nodes to make it clearer The actual nodes are still the same, you may have to double click red nodes in your apps and retype the names to recreate them.
- !Breaking change! Bugfix on winding direction node. With the calculation method I was using winding direction is potentially flipped in some spaces where Y is inverted. Between Stride and Skia we have a mix of spaces where this might be true. There is now a ‘YIncreasesDownward’ pin on the WindingDirection and ForceClockwise/CounterClockwise nodes. Check the helppatch ‘HowTo Calculate Winding Direction Of A Polygon’
- New Polygon2DPlus datatype, for a 2D polygon that is effectively annotated with a third dimension. The underlying 2D polygon can still be accessed and manipulated.
- Rearranged helppatches to make general geometric functions clearer
- Added sample a point on a line
- New 3D functions for dynamic geometry to make ‘polygon tubes’, where each element of the tube can have a different polygon face. See the new helppatches in 3D category. These come in several flavors where you
- LERP (morph) between two polygons, see HowTo LERP between Polygons helppatch
- Added sample a point on a polygon perimeter (previously only for PolyPath)
- Added DrawPolygonRadialLines to draw radial lines between origin and points
- Added DrawPolygonPointLabels to draw text labels at each point on a polygon
- Improved the TriangleContainsPoint helppatch
- Aspect changed on PolygonVisibility nodes to advanced.
- Added PointCount operation to Polygon datatype
V1.1.3
- Removed stride physics Raycast function now there is a native one shipped with vvvv 5.3
V1.1.2
- PolygonExtrude now has an additional 2D UV scaling option for the sides of the extrude. (Was U only in last release)
V1.1.1
- Rearranged and expanded the helppatches for PolygonPlane and PolygonExtrusions
- Added option to generate tangents, needed for normal (bump) mapping
- Added many options for texture mapping the 3D polygon objects
- For those planning to make their own dynamic meshes or models in stride the PolygonPlane and PolygonExtrusion patches are reasonably well documented examples, including with UV coordinates, tangents and bounding boxes.
- Added some tools for debugging stride entities as wireframe, vertices, tangents etc
V1.1.0
- Tested in vvvv gamma 5.0-stable
- Added UV map to the ExtrudedPolygon. This is not intended for every usecase but should be a good starting point.
- Fixed another bug with bounding boxes of PolygonPlane and ExtrudedPolygons that caused incorrect culling.
- Minor breaking change due to new signature of PolygonPlane and ExtrudedPolygon nodes (so they go red). Just double click on them and recreate them and you should be good to go.
V1.0.10
- Minor improvement to 3D polygon plane and extrusion nodes and helppatch
- Can set custom bounding box depth for the 3D polygon plane
V1.0.9
- Stride dependencies moved to separate document VL.PolyTools.Stride
V1.0.8
- Ensured compatibility with vvvv 2021.4.11-1313 (RC4)
- Fxed some helppatch windows potentially not opening
V1.0.7
- Made the bugfix from V1.0.6 optional as ‘Allow Perfect Diagonals’ on ‘HowTo Find Grid Cells Along A Line’
V1.0.6
- Fixed bug in line intersects grid calculation
V1.0.5
- Added second ‘Does Line Intersect Grid cells’ operation including all cells. See helpatch ‘HowTo Find Grid Cells Along A Line’
V1.0.4
- Added function for finding grid cells along a line based on Bresenhams Line Algorithm. See Helppatch ‘HowTo Find Grid Cells Along A Line’
- Added function for generating square-ish layout grids using a single count input. I say square-ish because it handles cases where the input count does not have a whole square root and a partial row/column might be needed. See HelpPatch ‘HowTo Generate a nearly Square GridSpread’
V1.0.3
*Helppatch improvements
*Consistent GetBounds method for Polygon and PolyPath
*Added Splitting Circles Example patch kindly contributed by ██ ██
*Added option to Compartments to avoid including outer stroke
License
Boost 1.0