PGS 1.3.0
Added
Classes
PGS_Hull
— a dedicated class for convex and concave hulls of polygons and point sets.PGS_SegmentSet
— a class that generates random sets of non-intersecting line segments.
Methods
equalPartition()
toPGS_Processing
. Partitions a shape into N approximately equal area polygons.trapezoidPartition()
toPGS_Processing
. Partitions a shape into axis-aligned trazepoids.fromChildren()
toPGS_Conversion
. Creates a single GROUP parent shape from a list of child shapes.WKT
andWKB
conversion methods toPGS_Conversion
. Converts PShapes to and from their Well-Known Text / Well-Known Binary representation.Encoded Polyline
conversion methods toPGS_Conversion
. Converts PShapes to and from a Google Encoded Polyline representation.GeoJSON
conversion methods toPGS_Conversion
. Converts PShapes to and from a GeoJSON representation.toJava2D()
andfromJava2D()
toPGS_Conversion
. Converts PShapes to and from Java2D/java.awt shape objects.originScale()
toPGS_Transformation
. Scales a shape relative to the origin (0, 0).resizeByWidth()
andresizeByHeight()
toPGS_Transformation
. Resizes a shape to a given width/height, whilst resizing the height/width to maintain the original aspect ratio.resizeByMajorAxis()
toPGS_Transformation
. Resizes a shape (based on the longest axis of its envelope) to a given size.translateEnvelopeTo()
andtranslateCornerTo()
toPGS_Transformation
. These methods translate a shape based on its envelope.- A new mesh-coloring algorithm:
GENETIC
, which finds a coloring via a genetic algorithm. toGraph()
toPGS_Conversion
. Converts a shape to a (jGraphT) graph, representing its dual-graph (this method was previously private).fromGraph()
toPGS_Conversion
. Converts a (jGraphT) graph to a shape, using a Force-Directed placement algorithm.sphericity()
,elongation()
andmaximumInteriorAngle()
toPGS_ShapePredicates
.findContainingShape()
toPGS_ShapePredicates
. Finds the child shape in a GROUP shape that contains a query point.overlap()
toPGS_ShapePredicates
. Measures the degree of mutual overlap between two shapes.equalsExact()
,equalsNorm()
andequalsTopo()
toPGS_ShapePredicates
. These methods test for equality between two shapes according to different criteria.createRectangularSpiral()
toPGS_Construction
. Creates a rectangular-shaped spiral.createBlobbie()
toPGS_Construction
. Creates a "blob"-like shape.largestEmptyCircle()
toPGS_Optimisation
. Finds the largest empty circle in a set of obstacle geometries.hilbertSort()
toPGS_PointSet
. Sorts a list of points according to their location on a Hilbert curve.tangentAngle()
toPGS_Processing
. Finds the angle a the line tangent to a shape at a certain point on its perimeter.variableBuffer()
toPGS_Morphology
. Buffers a shape with a buffer whose distance varies along the shape's perimeter.toGraph()
andtoDualGraph()
toPGS_Triangulation
. Converts a triangulation mesh to a direct, or dual, (jGraphT) graph representation.chordalAxis()
toPGS_Contour
. Finds the chordal axis (a type of skeleton) of a shape.tangencyPack()
toPGS_CirclePacking
. Generates a circle packing having a pattern of tangencies specified by a triangulation.- Added methods for Hilbert Curve, Sierpinski Carpet, Koch Snowflake and Sierpinski Tri-Curves to
PGS_Construction
. poissonN()
toPGS_PointSet
. Produces as Poisson distribution having exactly N points.removeHiddenLines()
toPGS_Processing
. Removes hidden lines from a set of overlapping/occluded polygons.relativeNeighborFaces()
toPGS_Meshing
. Finds the relative neighbour faces of a triangulation.spannerFaces()
toPGS_Meshing
. Finds the relative neighbour faces of a greedy sparse spanner of a triangulation.minimumSpanningTree()
toPGS_PointSet
. Finds the Euclidean minimum spanning tree of a set of points.repulsionPack()
toPGS_CirclePacking
. Generates a circle packing of a shape via iterative pair-repulsion.simplifyDCE()
toPGS_Morphology
. Simplifies a shape using Discrete Curve Evolution.compoundVoronoi()
toPGS_Voronoi
. Creates a Voronoi diagram for a set of disjoint shapes.- Additional method signature for
buffer()
that accepts a buffer style parameter. - Additional method signature for
offsetCurvesInward()
that accepts a curves number parameter. intersectMesh()
andsubtractMesh()
toPGS_ShapeBoolean
. Performs the associated boolean operations on mesh-like shapes, preserving individual faces during the operation (rather than dissolving remaining elements).dilationErosion()
toPGS_Morphology
. Applies a positive followed by a negative buffer (in a single operation).eliminateSlivers()
toPGS_Processing
. Removes narrow areas ("slivers") from a shape.reducePrecision()
toPGS_Morphology
. Reduces the precision of a shape, whilst ensuring the output shape is valid.distanceField()
toPGS_Contour
. Generates a contour map based on a distance field of a shape.hatchSubdivision()
toPGS_Tiling
. Randomly subdivides the plane into equal-width strips having varying lengths.squareTriangleTiling()
toPGS_Tiling
. Generates a non-periodic tiling, comprising squares and equilateral triangles.cleanCoverage()
toPGS_Processing
. Removes gaps and overlaps from meshes/polygon collections.sineWarp()
toPGS_Morphology
. Warps/perturbs a shape by displacing vertices according to a sine wave following the perimeter.hilbertSortFaces()
toPGS_Optimisation
. Sorts the faces of a GROUP shape according to hilbert curve index of each face's centroid coordinate.
Changed
- NOTE: Moved all hull methods from
PGS_Processing
toPGS_Hull
. - Renamed
partition()
toconvexPartition()
. PGS_Conversion.fromPShape()
(a major method used internally) now applies any shape affine transformations (such asrotate()
,scale()
,translate()
) to the resulting geometry.earCutTriangulation()
now uses JTS' implementation which supports inputs with holes.PGS_Morphology.smoothGaussian()
now uses a higher default resolution.PGS_Contour.straightSkeleton()
now supports multi-polygonal inputs and outputs faces (in addition to bones and branches, as before).PGS_Contour.straightSkeleton()
uses a different implementation that is ~50x faster!- Renamed
maximumInscribedRectangle()
tomaximumInscribedAARectangle()
("axis-aligned"). PGS_Optimisation.maximumInscribedRectangle()
now finds the maximum-area inscribed rectangle of arbitrary orientation.PGS_Transformation.touchScale()
now scales shapes that are contained within a larger shape.- Reimplemented
PGS_CirclePacking.maximumInstribedPack()
. New algorithm is perfectly accurate and is ~10x faster! PGS_Conversion.fromPVector()
now outputs an unclosed path shape if the input vertices are unclosed (rather than always treating the input as a closed polygon).PGS_Transformation.resize()
now resizes a shape with respect to its center.PGS_Morphology.smoothGaussian()
now supports polygons with holes.- Reimplemented
PGS_PointSet.poisson()
. New algorithm is faster and produces better quality point set outputs. - Styling methods in
PGS_Conversion()
(such assetAllFillColor()
) now return the (mutated) input (rather than beingpublic void
), to help method chaining. - GROUP PShapes having different child types (paths and polygons for instance) are now fully preserved during PShape<->Geometry conversion.
snapHull()
now uses a JTS-based implementation which improves the range of output and meaningfulness of the snap parameter (now 0...1).- All methods in
PGS_ShapePredicates()
now outputdouble
.
Fixed
- NPE when shapes created with
createShape()
in the P2D renderer were passed tofromPShape()
(#55). slice()
would sometimes fail to return some rectangular slices on a concave input (and it's more robust too now).- Error if a GROUP shape was passed to
point(s)OnExterior()
methods. - Triangulation methods now respect holes on shapes whose vertices wind opposite to convention (such as letter shapes created from
PFonts
). fromPShape()
now properly converts singular shapes consisting of multiple contours that in turn represent multiple polygons (#67). (Note boolean flagHANDLE_MULTICONTOUR
should be toggled to enabled this feature).- Conversion error with shapes created via
createShape(TRIANGLE)
. edgeCollapse
andcentroid
quadrangulation methods now respect shape/triangulation holes.
Removed
earCutTriangulation(List<PVector> points)
fromPGS_Triangulation
.isolinesFromGrid()
fromPGS_Contour
(dependency too large).voronoiCirclesDiagram()
fromPGS_Voronoi
(achieved bycompoundVoronoi()
).voronoiCells()
fromPGS_Voronoi
(replaced byinnerVoronoi()
).voronoiDiagram(IncrementalTin tin)
fromPGS_Voronoi
.
Bonus: the size of the .jar has been reduced a lot by removing a couple of dependencies that had many transitive dependencies!