public final class PGS_ShapeBoolean extends Object
Modifier and Type | Method and Description |
---|---|
static processing.core.PShape |
complement(processing.core.PShape shape,
double width,
double height)
Calculates the complement (or inverse) of the provided shape within a
rectangular boundary of specified width and height.
|
static processing.core.PShape |
intersect(processing.core.PShape a,
processing.core.PShape b)
Calculates the intersection of two shapes, producing a new shape representing
the shared area.
|
static processing.core.PShape |
intersectMesh(processing.core.PShape mesh,
processing.core.PShape area)
Performs an intersection operation between a mesh-like shape (a polygonal
coverage) and a polygonal area, while preserving the individual features of
the mesh during the operation.
|
static processing.core.PShape |
simpleSubtract(processing.core.PShape shell,
processing.core.PShape holes)
Subtracts
holes from the shell , without geometric
processing. |
static processing.core.PShape |
subtract(processing.core.PShape a,
processing.core.PShape b)
Subtracts one shape (b) from another shape (a) and returns the resulting
shape.
|
static processing.core.PShape |
subtractMesh(processing.core.PShape mesh,
processing.core.PShape area)
Subtracts a polygonal area from a mesh-like shape or polygonal coverage,
ensuring each individual face or feature of the mesh is preserved during the
operation.
|
static processing.core.PShape |
symDifference(processing.core.PShape a,
processing.core.PShape b)
Calculates the symmetric difference between two shapes.
|
static processing.core.PShape |
union(Collection<processing.core.PShape> shapes)
Performs a geometric union operation on a collection of shapes, merging them
into a new shape that represents the total area of all the input shapes.
|
static processing.core.PShape |
union(processing.core.PShape... shapes)
Performs a geometric union operation on a variable number of shapes, merging
them into a new shape that encompasses the total area of all input shapes.
|
static processing.core.PShape |
union(processing.core.PShape a,
processing.core.PShape b)
Combines two shapes into a single new shape, representing the total area of
both input shapes.
|
static processing.core.PShape |
unionMesh(Collection<processing.core.PShape> faces) |
static processing.core.PShape |
unionMesh(processing.core.PShape mesh)
Merges a mesh-like PShape (i.e., a GROUP PShape whose children represent
faces with shared edges) into a single shape that denotes the boundary of the
entire mesh.
|
static processing.core.PShape |
unionMeshWithoutHoles(Collection<processing.core.PShape> mesh)
Deprecated.
This method is deprecated due to the lack of support for meshes
with holes.
|
public static processing.core.PShape intersect(processing.core.PShape a, processing.core.PShape b)
When intersecting a polygon with a path or linestring, the method will trim the path to the polygon's boundaries.
Note: When intersecting a mesh-like shape with a polygon, the remaining
intersecting parts of individual faces will be collapsed into a single area.
To preserve individual faces during intersection, use
intersectMesh()
.
a
- The first shape to be intersected.b
- The second shape to intersect with the first.public static processing.core.PShape intersectMesh(processing.core.PShape mesh, processing.core.PShape area)
When a mesh-like shape or polygonal coverage is intersected with a polygon
using the general intersect(a, b)
method,
the result is a single polygon that consists of the unified or dissolved area
of all intersecting mesh faces. Depending on the requirements of your task,
this behavior may not be optimal. The current method addresses this issue by
preserving the individual intersections of each mesh face.
This method performs faster than invoking the
intersect(a, b)
method repeatedly for
every face of a mesh-like shape a
against an area
b
.
mesh
- A mesh-like GROUP shape that will be intersected with the
polygonal area.area
- A polygonal shape with which the mesh will be intersected.public static processing.core.PShape union(processing.core.PShape a, processing.core.PShape b)
This method performs a geometric union operation, "gluing" the two input shapes together to create a new shape that encompasses the combined area of both inputs. If the input shapes overlap, the overlapping area is included only once in the resulting shape.
a
- The first shape to be unified.b
- The second shape to be unified with the first.For union operations on multiple shapes.
public static processing.core.PShape union(Collection<processing.core.PShape> shapes)
shapes
- A list of PShapes to be unified.For a union operation on two shapes.
,
For union operations on a variable number of shapes.
public static processing.core.PShape union(processing.core.PShape... shapes)
shapes
- A variable number of PShape instances to be unified.For a union operation on two shapes.
,
For a union operation on a list of shapes.
public static processing.core.PShape unionMesh(Collection<processing.core.PShape> faces)
faces
- collection of faces comprising a meshunionMesh(PShape)
public static processing.core.PShape unionMesh(processing.core.PShape mesh)
The mesh can contain holes and these will be correctly processed and reflected in the final output.
mesh
- A GROUP PShape, where each child shape forms part of a mesh,
meaning they join or overlap at edges.public static processing.core.PShape unionMeshWithoutHoles(Collection<processing.core.PShape> mesh)
unionMesh(PShape)
if the input is known to have
no holes.
This method calculates the set of unique edges belonging to the mesh, which is equivalent to the boundary, assuming a mesh without holes. It then determines a sequential/winding order for the vertices of the boundary.
Note: This method does not account for meshes with holes.
mesh
- A collection of shapes representing a mesh.public static processing.core.PShape subtract(processing.core.PShape a, processing.core.PShape b)
Subtract is the opposite of union()
.
a
- The PShape from which the other PShape will be subtracted.b
- The PShape that will be subtracted from the first PShape.simpleSubtract(PShape, PShape)
public static processing.core.PShape simpleSubtract(processing.core.PShape shell, processing.core.PShape holes)
holes
from the shell
, without geometric
processing.
Rather than performing geometric overlay, this method simply appends the
holes as contours to the shell. For this reason, it is faster than
subtract()
but this method produces valid
results only if all holes lie inside the shell and holes are not
nested.
shell
- polygonal shapeholes
- single polygon, or GROUP shape, whose children are holes that
lie within the shellsubtract(PShape, PShape)
public static processing.core.PShape subtractMesh(processing.core.PShape mesh, processing.core.PShape area)
The method subtract(a, b)
subtracts a
polygon from a mesh, producing a single polygon that represents the combined
and dissolved area of all remaining mesh face parts. This method offers an
alternative to preserve how each face is individually affected by the
subtraction.
This method is more efficient than repeatedly calling
subtract(a, b)
on each face of a mesh-like
shape.
mesh
- A GROUP PShape that represents a mesh-like shape.area
- A polygonal PShape from which the mesh shape is subtracted.public static processing.core.PShape symDifference(processing.core.PShape a, processing.core.PShape b)
a
- The first shape.b
- The second shape.public static processing.core.PShape complement(processing.core.PShape shape, double width, double height)
The resulting shape corresponds to the portion of the rectangle not covered by the input shape. The operation is essentially a subtraction of the input shape from the rectangle.
shape
- The input shape for which the complement is to be determined.width
- The width of the rectangular boundary.height
- The height of the rectangular boundary.Copyright © 2023. All rights reserved.