public final class PolygonModelFactory
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL
|
static int |
CHECK_EDGE_INTERSECTIONS
This action value determines whether it should be checked
if there are edge-edge intersections between the edges of the polygon, which are not allowed.
|
static int |
MERGE_EDGES
Since polygon models do not allow two neighboring edges with an angle of
180 degrees
between them, these kind of edges have to be merged to create a valid polygon model. |
static int |
NONE
No actions will be executed when calling
createPolygonModel(PolygonModelType, LinkedHashSet, int). |
static int |
VERIFIY_TYPE
This action value determines whether it should be checked
if the polygon model fits the definition of the given polygon model type.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Optional<PolygonModel<PolygonModelType.Convex>> |
createConvexHull(java.util.Set<Vec<Two>> points)
Creates a polygon hull on which all points of a given list of points lie on.
|
static <T extends PolygonModelType> |
createPolygonModel(T type,
java.util.LinkedHashSet<Vec<Two>> points,
int actions)
Creates a polygon model from an ordered set of points.
|
static java.util.Set<PolygonModel<PolygonModelType.Convex>> |
triangulate(PolygonModel<?> p)
Converts a simple polygon model into many smaller triangle models.
|
public static final int NONE
createPolygonModel(PolygonModelType, LinkedHashSet, int).public static final int MERGE_EDGES
180 degrees
between them, these kind of edges have to be merged to create a valid polygon model.
If it's possible that these kind of edges exist, this action value should be used
when calling createPolygonModel(PolygonModelType, LinkedHashSet, int).
public static final int VERIFIY_TYPE
This action value should be used when calling createPolygonModel(PolygonModelType, LinkedHashSet, int)
if it's possible that the polygon model and the specified polygon model type are not compatible.
public static final int CHECK_EDGE_INTERSECTIONS
This action value should be used when calling createPolygonModel(PolygonModelType, LinkedHashSet, int)
if it's possible that the polygon can have intersecting edges.
public static final int ALL
public static <T extends PolygonModelType> java.util.Optional<PolygonModel<T>> createPolygonModel(T type, java.util.LinkedHashSet<Vec<Two>> points, int actions)
type - the type of the polygon modelpoints - the list of points out of which the polygon model should be createdactions - the actions which should be executed to verifiy that the polygon model will be valid.
Multiple actions can be combined using the bitwise OR operator.points lies on.
If no polygon model can be created, an empty Optional will be returned.java.lang.NullPointerException - if type or points is nullpublic static java.util.Optional<PolygonModel<PolygonModelType.Convex>> createConvexHull(java.util.Set<Vec<Two>> points)
points - the list of points out of which the hull should be createdpoints lies on.
If no polygon model can be created, an empty Optional will be returned.java.lang.NullPointerException - if points is nullpublic static java.util.Set<PolygonModel<PolygonModelType.Convex>> triangulate(PolygonModel<?> p)
p - the polygon model which should be split into trianglespjava.lang.NullPointerException - if pp is null