Package toxi.geom
Class GridTesselator
java.lang.Object
toxi.geom.GridTesselator
- All Implemented Interfaces:
PolygonTesselator
- Direct Known Subclasses:
GlobalGridTesselator,LocalGridTesselator
This is an implementation of the
PolygonTesselator interface and
abstract parent class for tesselating 2D polygons using a grid of additional
points created within the polygon. These inlier points are connected to the
original polygon vertices using a DelaunayTriangulation. The quality
and final amount of triangles used can be adjusted via the number of
additional grid points. This class currently has two concrete
implementations: GlobalGridTesselator and LocalGridTesselator
.-
Constructor Summary
ConstructorsConstructorDescriptionGridTesselator(float res) Creates a new instance with the given grid resolution.GridTesselator(float res, float rootSize) Creates a new instance with the given grid resolution. -
Method Summary
Modifier and TypeMethodDescriptionfloatvoidsetResolution(float res) tesselatePolygon(Polygon2D poly) Tesselates/decomposes the given polygon into a list of 2D triangles using the currently set grid resolution.
-
Constructor Details
-
GridTesselator
public GridTesselator(float res) Creates a new instance with the given grid resolution.- Parameters:
res- snap distance for grid points
-
GridTesselator
public GridTesselator(float res, float rootSize) Creates a new instance with the given grid resolution.- Parameters:
res- snap distance for grid points
-
-
Method Details
-
getResolution
public float getResolution() -
setResolution
public void setResolution(float res) -
tesselatePolygon
Tesselates/decomposes the given polygon into a list of 2D triangles using the currently set grid resolution.- Specified by:
tesselatePolygonin interfacePolygonTesselator- Parameters:
poly- polygon to be tesselated- Returns:
- list of triangles
-