public final class Polygon
extends java.lang.Object
shared
property, which is shared between
all polygons that are clones of each other or where split from the same
polygon. This can be used to define per-polygon properties (such as surface
color).Modifier and Type | Field and Description |
---|---|
eu.mihosoft.jcsg.Plane |
_csg_plane
Plane defined by this polygon.
|
java.util.List<Vertex> |
vertices
Polygon vertices
|
Constructor and Description |
---|
Polygon(java.util.List<Vertex> vertices)
Constructor.
|
Polygon(java.util.List<Vertex> vertices,
PropertyStorage shared)
Constructor.
|
Polygon(Vertex... vertices)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
eu.mihosoft.vvecmath.Vector3d |
centroid() |
Polygon |
clone() |
boolean |
contains(Polygon p) |
boolean |
contains(eu.mihosoft.vvecmath.Vector3d p)
Indicates whether the specified point is contained within this polygon.
|
Polygon |
flip()
Flips this polygon.
|
Polygon |
flipped()
Returns a flipped copy of this polygon.
|
static java.util.List<Polygon> |
fromConcavePoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points)
Decomposes the specified concave polygon into convex polygons.
|
static java.util.List<Polygon> |
fromConcavePoints(eu.mihosoft.vvecmath.Vector3d... points)
Decomposes the specified concave polygon into convex polygons.
|
static Polygon |
fromPoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points)
Creates a polygon from the specified point list.
|
static Polygon |
fromPoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points,
PropertyStorage shared)
Creates a polygon from the specified point list.
|
static Polygon |
fromPoints(eu.mihosoft.vvecmath.Vector3d... points)
Creates a polygon from the specified points.
|
Bounds |
getBounds()
Returns the bounds of this polygon.
|
eu.mihosoft.vvecmath.Plane |
getPlane()
Returns the plane defined by this triangle.
|
PropertyStorage |
getStorage() |
boolean |
intersects(Polygon p)
Deprecated.
|
boolean |
isValid()
Indicates whether this polyon is valid, i.e., if it
|
java.lang.String |
toStlString()
Returns this polygon in STL string format.
|
java.lang.StringBuilder |
toStlString(java.lang.StringBuilder sb)
Returns this polygon in STL string format.
|
java.util.List<Polygon> |
toTriangles()
Returns a triangulated version of this polygon.
|
Polygon |
transform(eu.mihosoft.vvecmath.Transform transform)
Applies the specified transformation to this polygon.
|
Polygon |
transformed(eu.mihosoft.vvecmath.Transform transform)
Returns a transformed copy of this polygon.
|
Polygon |
translate(eu.mihosoft.vvecmath.Vector3d v)
Translates this polygon.
|
Polygon |
translated(eu.mihosoft.vvecmath.Vector3d v)
Returns a translated copy of this polygon.
|
public final java.util.List<Vertex> vertices
public final eu.mihosoft.jcsg.Plane _csg_plane
public Polygon(java.util.List<Vertex> vertices, PropertyStorage shared)
vertices
- polygon verticesshared
- shared propertypublic Polygon(java.util.List<Vertex> vertices)
vertices
- polygon verticespublic Polygon(Vertex... vertices)
vertices
- polygon verticespublic eu.mihosoft.vvecmath.Plane getPlane()
public static java.util.List<Polygon> fromConcavePoints(eu.mihosoft.vvecmath.Vector3d... points)
points
- the points that define the polygonpublic static java.util.List<Polygon> fromConcavePoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points)
points
- the points that define the polygonpublic boolean isValid()
public Polygon clone()
clone
in class java.lang.Object
public Polygon flip()
public Polygon flipped()
public java.lang.String toStlString()
public java.lang.StringBuilder toStlString(java.lang.StringBuilder sb)
sb
- string builderpublic java.util.List<Polygon> toTriangles()
public Polygon translate(eu.mihosoft.vvecmath.Vector3d v)
v
- the vector that defines the translationpublic Polygon translated(eu.mihosoft.vvecmath.Vector3d v)
v
- the vector that defines the translationpublic Polygon transform(eu.mihosoft.vvecmath.Transform transform)
transform
- the transformation to applypublic Polygon transformed(eu.mihosoft.vvecmath.Transform transform)
transform
- the transformation to applypublic static Polygon fromPoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points, PropertyStorage shared)
points
- the points that define the polygonshared
- shared property storagepublic static Polygon fromPoints(java.util.List<eu.mihosoft.vvecmath.Vector3d> points)
points
- the points that define the polygonpublic static Polygon fromPoints(eu.mihosoft.vvecmath.Vector3d... points)
points
- the points that define the polygonpublic Bounds getBounds()
public eu.mihosoft.vvecmath.Vector3d centroid()
public boolean contains(eu.mihosoft.vvecmath.Vector3d p)
p
- pointtrue
if the point is inside the polygon or on one of the
edges; false
otherwise@Deprecated public boolean intersects(Polygon p)
public boolean contains(Polygon p)
public PropertyStorage getStorage()