Class PGS_Coloring
This class differentiates between "conforming meshes" and "non-conforming meshes".
Conforming Meshes : Consist of adjacent cells that share edges and
every pair of shared edges are identical, meaning they have the same
coordinates. An example of a conforming mesh is a triangulation.
Non-Conforming Meshes : Consist of adjacent cells that share edges
(i.e. edges may overlap) but adjacent edges do not necessarily have identical
start and end coordinates.
- Since:
- 1.2.0
- Author:
- Michael Carleton
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies the algorithm/heuristic used by the underlying graph coloring process to find an approximate minimal coloring for mesh faces. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncolorMesh(Collection<processing.core.PShape> shapes, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given mesh shape, returning a color class for each mesh face.static processing.core.PShapecolorMesh(processing.core.PShape meshShape, int[] colorPalette) Computes a coloring of the given mesh shape using the default coloring algorithm (DBLAC) and applies the provided palette to its faces.colorMesh(processing.core.PShape meshShape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given mesh shape, returning a color class for each mesh face.static processing.core.PShapecolorMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, int[] colorPalette) Computes a coloring of the given mesh shape and colors its faces using the colors provided.static processing.core.PShapecolorMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, String[] colorPalette) Computes a coloring of the given mesh shape and colors its faces using the colors provided.static processing.core.PShapecolorNonMesh(processing.core.PShape meshShape, int[] colorPalette) Colors a non-conforming mesh-likePShapeusing the default coloring algorithm (DBLAC) and the provided palette.colorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given non-conforming mesh shape, returning a color class for each face of the pre-processed (noded) mesh.static processing.core.PShapecolorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, int[] colorPalette) Computes a coloring of the given non-conforming mesh shape and colors the faces of its noded representation using the colors provided.static processing.core.PShapecolorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, String[] colorPalette) Computes a coloring of the given non-conforming mesh shape and colors the faces of its noded representation using the colors provided.
-
Field Details
-
SEED
public static long SEED
-
-
Method Details
-
colorMesh
public static Map<processing.core.PShape,Integer> colorMesh(processing.core.PShape meshShape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given mesh shape, returning a color class for each mesh face.- Parameters:
meshShape- a GROUP PShape, whose children constitute the faces of a conforming meshcoloringAlgorithm- coloring algorithm used to color the mesh- Returns:
- a color-class map; a mapping of each mesh face (PShape) -> color class (integer)
-
colorMesh
public static Map<processing.core.PShape,Integer> colorMesh(Collection<processing.core.PShape> shapes, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given mesh shape, returning a color class for each mesh face.- Parameters:
shapes- a collection of shapes that constitute the faces of a conforming meshcoloringAlgorithm- coloring algorithm used to color the mesh- Returns:
- a color-class map; a mapping of each mesh face (PShape) -> color class (integer)
-
colorMesh
public static processing.core.PShape colorMesh(processing.core.PShape meshShape, int[] colorPalette) Computes a coloring of the given mesh shape using the default coloring algorithm (DBLAC) and applies the provided palette to its faces.This method mutates the fill colour of the input
meshShapeby setting the fill of each child facePShape. If the computed number of required colors exceeds the palette length.- Parameters:
meshShape- a GROUPPShapewhose children constitute the faces of a conforming meshcolorPalette- the colors with which to color the mesh- Returns:
- the input
meshShape(whose faces have now been colored) - See Also:
-
colorNonMesh
public static processing.core.PShape colorNonMesh(processing.core.PShape meshShape, int[] colorPalette) Colors a non-conforming mesh-likePShapeusing the default coloring algorithm (DBLAC) and the provided palette.Unlike
colorMesh(), this method is intended for inputs whose faces do not form a conforming planar mesh (e.g., adjacent faces may overlap, have T-junctions, or otherwise fail to share fully noded boundaries). The input is first converted to a noded (conforming) representation and the resulting faces are then colored.- Parameters:
meshShape- a GROUPPShapewhose children are faces of a non-conforming mesh-like planar subdivisioncolorPalette- palette of colors used to fill the resulting noded faces- Returns:
- a noded (conforming) GROUP
PShapederived frommeshShape, with its faces colored - Since:
- 2.2
- See Also:
-
colorMesh
public static processing.core.PShape colorMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, int[] colorPalette) Computes a coloring of the given mesh shape and colors its faces using the colors provided. This method mutates the fill colour of the input shape.- Parameters:
shape- a GROUP PShape, whose children constitute the faces of a conforming meshcoloringAlgorithm- coloring algorithm used to color the meshcolorPalette- the (integer) colors with which to color the mesh- Returns:
- the input shape (whose faces have now been colored)
-
colorMesh
public static processing.core.PShape colorMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, String[] colorPalette) Computes a coloring of the given mesh shape and colors its faces using the colors provided. This method mutates the fill colour of the input shape.- Parameters:
shape- a GROUP PShape, whose children constitute the faces of a conforming meshcoloringAlgorithm- coloring algorithm used to color the meshcolorPalette- the string colors (e.g. "#FFFFFF", or "cba5e8") with which to color the mesh- Returns:
- the input shape (whose faces have now been colored)
-
colorNonMesh
public static Map<processing.core.PShape,Integer> colorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm) Computes a coloring of the given non-conforming mesh shape, returning a color class for each face of the pre-processed (noded) mesh.- Parameters:
shape- a GROUP PShape, whose children constitute the faces of a non-conforming meshcoloringAlgorithm- coloring algorithm used to color the mesh- Returns:
- a color-class map; a mapping of each noded mesh face (PShape) -> color class (integer)
-
colorNonMesh
public static processing.core.PShape colorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, int[] colorPalette) Computes a coloring of the given non-conforming mesh shape and colors the faces of its noded representation using the colors provided.- Parameters:
shape- a GROUP PShape, whose children constitute the faces of a non-conforming meshcoloringAlgorithm- coloring algorithm used to color the meshcolorPalette- the (integer) colors with which to color the mesh- Returns:
- noded representation of the input shape (whose faces have now been colored)
-
colorNonMesh
public static processing.core.PShape colorNonMesh(processing.core.PShape shape, PGS_Coloring.ColoringAlgorithm coloringAlgorithm, String[] colorPalette) Computes a coloring of the given non-conforming mesh shape and colors the faces of its noded representation using the colors provided.- Parameters:
shape- a GROUP PShape, whose children constitute the faces of a non-conforming meshcoloringAlgorithm- coloring algorithm used to color the meshcolorPalette- the string colors (e.g. "#FFFFFF", or "cba5e8") with which to color the mesh- Returns:
- noded representation of the input shape (whose faces have now been colored)
-