public class PGS_Meshing extends Object
Many of the methods within this class process an existing Delaunay
triangulation; you may first generate such a triangulation from a shape using
the
delaunayTriangulationMesh()
method.
Modifier and Type | Method and Description |
---|---|
static processing.core.PShape |
areaMerge(processing.core.PShape mesh,
double areaThreshold)
Recursively merges smaller faces of a mesh into their adjacent faces.
|
static processing.core.PShape |
centroidQuadrangulation(org.tinfour.common.IIncrementalTin triangulation,
boolean preservePerimeter)
Generates a quadrangulation from a triangulation by "inverting" triangles
(for each triangle, create edges joining its centroid to each of its
vertices).
|
static processing.core.PShape |
dualFaces(org.tinfour.common.IIncrementalTin triangulation)
Generates a (mesh-like) shape consisting of polygonal faces of the dual graph
of the given triangulation.
|
static processing.core.PShape |
edgeCollapseQuadrangulation(org.tinfour.common.IIncrementalTin triangulation,
boolean preservePerimeter)
Generates a quadrangulation from a triangulation by selectively removing (or
"collapsing") the edges shared by neighboring triangles (via edge coloring).
|
static processing.core.PShape |
extractInnerEdges(processing.core.PShape mesh)
Extracts all inner edges from a mesh.
|
static processing.core.PShape |
gabrielFaces(org.tinfour.common.IIncrementalTin triangulation,
boolean preservePerimeter)
Generates a shape consisting of polygonal faces of a Gabriel graph.
|
static processing.core.PShape |
nodeNonMesh(processing.core.PShape shape)
Transforms a non-conforming mesh shape into a conforming mesh by
performing a "noding" operation.
|
static processing.core.PShape |
relativeNeighborFaces(org.tinfour.common.IIncrementalTin triangulation,
boolean preservePerimeter)
Generates a shape consisting of polygonal faces of a Relative neighborhood
graph (RNG).
|
static processing.core.PShape |
simplifyMesh(processing.core.PShape mesh,
double tolerance,
boolean preservePerimeter)
Simplifies the boundaries of the faces in a mesh while preserving the
original mesh topology.
|
static processing.core.PShape |
smoothMesh(processing.core.PShape mesh,
double displacementCutoff,
boolean preservePerimeter)
Smoothes a mesh via iterative weighted Laplacian smoothing.
|
static processing.core.PShape |
smoothMesh(processing.core.PShape mesh,
int iterations,
boolean preservePerimeter,
double taubin,
double t2)
Smoothes a mesh via iterative weighted Laplacian smoothing.
|
static processing.core.PShape |
spannerFaces(org.tinfour.common.IIncrementalTin triangulation,
int k,
boolean preservePerimeter)
Generates a shape consisting of polygonal faces formed by edges returned by a
greedy sparse spanner applied to a triangulation.
|
static processing.core.PShape |
spiralQuadrangulation(List<processing.core.PVector> points)
Produces a quadrangulation from a point set.
|
static processing.core.PShape |
splitEdges(processing.core.PShape split,
int parts)
Splits each edge of a given mesh shape into a specified number of
equal-length parts and creates a new shape from the resulting smaller edges.
|
static processing.core.PShape |
splitQuadrangulation(org.tinfour.common.IIncrementalTin triangulation)
Produces a quadrangulation from a triangulation, by splitting each triangle
into three quadrangles (using the Catmull and Clark technique).
|
static processing.core.PShape |
stochasticMerge(processing.core.PShape mesh,
int nClasses,
long seed)
Randomly merges together / dissolves adjacent faces of a mesh.
|
static processing.core.PShape |
subdivideMesh(processing.core.PShape mesh,
double edgeSplitRatio)
Subdivides the faces of a mesh using the Catmull-Clark split approach,
wherein each face is divided into N parts, where N is the number of vertices
in the shape.
|
static processing.core.PShape |
urquhartFaces(org.tinfour.common.IIncrementalTin triangulation,
boolean preservePerimeter)
Generates a shape consisting of polygonal faces of an Urquhart graph.
|
public static processing.core.PShape urquhartFaces(org.tinfour.common.IIncrementalTin triangulation, boolean preservePerimeter)
In practice this is a way to tessellate a shape into polygons (with the
resulting tessellation being in between a
triangulation
and a
partition
).
Note that this method processes a Delaunay triangulation. Process a shape
using
delaunayTriangulationMesh()
first and then feed it to this method.
The Urquhart graph is a good approximation to the
relative
neighborhood
graph (having only about 2% additional edges).
triangulation
- a triangulation meshpreservePerimeter
- whether to retain/preserve edges on the perimeter
even if they should be removed according to the
urquhart conditiongabrielFaces(IIncrementalTin, boolean)
public static processing.core.PShape gabrielFaces(org.tinfour.common.IIncrementalTin triangulation, boolean preservePerimeter)
In practice this is a way to tessellate a shape into polygons (with the resulting tessellation being reminiscent of shattering the shape as if it were glass).
Note that this method processes a Delaunay triangulation. Process a shape
using
delaunayTriangulationMesh()
first and then feed it to this method.
triangulation
- a triangulation meshpreservePerimeter
- whether to retain/preserve edges on the perimeter
even if they should be removed according to the
gabriel conditionurquhartFaces(IIncrementalTin, boolean)
public static processing.core.PShape relativeNeighborFaces(org.tinfour.common.IIncrementalTin triangulation, boolean preservePerimeter)
An RNG is obtained by removing each edge E from a triangulation if any vertex is nearer to both vertices of E than the length of E.
The RNG is a subgraph of the urquhart
graph, having only slightly fewer edges.
triangulation
- a triangulation meshpreservePerimeter
- whether to retain/preserve edges on the perimeter
even if they should be removed according to the
relative neighbor conditionpublic static processing.core.PShape spannerFaces(org.tinfour.common.IIncrementalTin triangulation, int k, boolean preservePerimeter)
triangulation
- a triangulation meshk
- the order of the spanner. Should be at least 1.
Higher numbers collapse more edges resulting in
larger faces, until a single face remainspreservePerimeter
- whether to retain/preserve edges on the perimeter
even if they should be removed according to the
spanner conditionpublic static processing.core.PShape dualFaces(org.tinfour.common.IIncrementalTin triangulation)
In practice, the resulting dual mesh has hexagonal-like cells.
Note that this method processes a Delaunay triangulation. Process a shape
using
delaunayTriangulationMesh()
first and then feed it to this method.
If the input has been generated from a PShape, consider generating the
triangulation with refinements > 1
for better dual mesh results.
triangulation
- a triangulation meshpublic static processing.core.PShape splitQuadrangulation(org.tinfour.common.IIncrementalTin triangulation)
Since this method employs a very simple technique to produce a quadrangulation, the result is poor-quality, containing many helix-like structures (it's not at all "regular").
Note that this method processes a Delaunay triangulation. Process a shape
using
delaunayTriangulationMesh()
first and then feed it to this method.
triangulation
- a triangulation meshpublic static processing.core.PShape edgeCollapseQuadrangulation(org.tinfour.common.IIncrementalTin triangulation, boolean preservePerimeter)
This method may be slow on large inputs (as measured by vertex count), owing to the graph coloring it performs.
triangulation
- a triangulation meshpreservePerimeter
- whether to preserve the perimeter of the input
triangulation; when true, retains edges that lie on
the perimeter of the triangulation mesh that would
have otherwise been removed (this results in some
triangles being included in the output).public static processing.core.PShape centroidQuadrangulation(org.tinfour.common.IIncrementalTin triangulation, boolean preservePerimeter)
This approach tends to create a denser quad mesh than
on the same input.edgeCollapseQuadrangulation()
triangulation
- a triangulation meshpreservePerimeter
- whether to preserve the perimeter of the input
triangulation; when true, retains edges that lie on
the perimeter of the triangulation mesh that would
have otherwise been removed (this results in some
triangles being included in the output).public static processing.core.PShape spiralQuadrangulation(List<processing.core.PVector> points)
points
- public static processing.core.PShape nodeNonMesh(processing.core.PShape shape)
shape
- a GROUP PShape which represents a mesh-like shape, but one that
isn't conforming (i.e. adjacent edges do not necessarily have
identical start and end coordinates)public
since 1.4.0public static processing.core.PShape stochasticMerge(processing.core.PShape mesh, int nClasses, long seed)
The procedure randomly assigns a integer ID to each face and then groups of mutually adjacent faces that share an ID (belong to the same group) are merged into one.
mesh
- the conforming mesh shape to perform the operation onnClasses
- the number of classes to assign to mesh faces; fewer classes
means adjacent faces are more likely to share a class and be
merged.seed
- the seed for the random number generatorpublic static processing.core.PShape smoothMesh(processing.core.PShape mesh, int iterations, boolean preservePerimeter, double taubin, double t2)
In Laplacian smoothing, vertices are replaced with the (weighted) average of the positions of their adjacent vertices; it is computationally inexpensive and fairly effective (faces become more isotropic), but it does not guarantee improvement in element quality.
Meshes with more faces take more iterations to converge to stable point. Meshes with highly convex faces may result in issues.
mesh
- a GROUP PShape where each child shape is a single
face comprising a conforming meshiterations
- number of smoothing passes to perform. Most meshes
will converge very well by around 50-100 passes.preservePerimeter
- boolean flag to exclude the boundary vertices from
being smoothed (thus preserving the mesh perimeter).
Generally this should be set to true, otherwise the
mesh will shrink as it is smoothed.public static processing.core.PShape smoothMesh(processing.core.PShape mesh, double displacementCutoff, boolean preservePerimeter)
This particular method iteratively smoothes the mesh until the displacement
value of the most displaced vertex in the prior iteration is less than
displacementCutoff
.
In Laplacian smoothing, vertices are replaced with the (weighted) average of the positions of their adjacent vertices; it is computationally inexpensive and fairly effective (faces become more isotropic), but it does not guarantee improvement in element quality.
Meshes with more faces take more iterations to converge to stable point. Meshes with highly convex faces may result in issues.
mesh
- a GROUP PShape where each child shape is a single
face comprising a conforming mesh.displacementCutoff
- the displacement threshold of the most displaced
vertex in a single iteration to stop the iterative
smoothing.preservePerimeter
- boolean flag to exclude the boundary vertices from
being smoothed (thus preserving the mesh
perimeter). Generally this should be set to true,
otherwise the mesh will shrink as it is smoothed.public static processing.core.PShape simplifyMesh(processing.core.PShape mesh, double tolerance, boolean preservePerimeter)
mesh
- GROUP shape comprising the faces of a conforming
meshtolerance
- the simplification tolerance for area-based
simplification. Roughly equal to the maximum
distance by which a simplified line can change from
the original.preservePerimeter
- whether to only simplify inner-boundaries and
leaving outer boundary edges unchanged.public static processing.core.PShape subdivideMesh(processing.core.PShape mesh, double edgeSplitRatio)
edgeSplitRatio
and
connected to the face centroid.
This subdivision method is most effective on meshes whose faces are convex and have a low vertex count (i.e., less than 6), where edge division points correspond between adjacent faces. This method may fail on meshes with highly concave faces because centroid-vertex visibility is not guaranteed.
mesh
- The mesh containing faces to subdivide.edgeSplitRatio
- The distance ratio [0...1] along each edge where the
faces are subdivided. A value of 0.5 is mid-edge
division (recommended value for a simple subvision).public static processing.core.PShape extractInnerEdges(processing.core.PShape mesh)
mesh
- The conforming mesh shape to extract inner edges from.public static processing.core.PShape areaMerge(processing.core.PShape mesh, double areaThreshold)
mesh
- a GROUP shape representing a conforming mesh the mesh to
perform area merging onareaThreshold
- The maximum permissible area threshold for merging
faces. Any faces smaller than this threshold will be
consolidated into their neighboring faces.public static processing.core.PShape splitEdges(processing.core.PShape split, int parts)
split
- The PShape representing a polygon to be split into smaller
edges.parts
- The number of equal parts each edge of the polygon should be
split into. Should be a positive integer, but if less than 1,
it's reset to 1.Copyright © 2023. All rights reserved.