Package com.solibri.geometry.primitive3d
Interface Polygon3d
-
- All Known Subinterfaces:
MPolygon3d
,MRectangle3d
,MTriangle3d
,Rectangle3d
,Triangle3d
public interface Polygon3d extends Iterable<Vector3d>
Read-only interface for handling simple polygons without holes in 3-dimensional space.- Since:
- 9.10.2
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
contains(Vector3d point)
Returns true if the given point is inside this polygon.boolean
contains(Polygon3d polygon)
Returns true if the given polygon is contained inside this polygon.static Polygon3d
create(Polygon3d polygon)
Creates a polygon with the contents deep copied from the given polygon.static Polygon3d
create(List<? extends Vector3d> vertices)
Creates a polygon with the given vertices.boolean
edgesIntersect(Polygon3d polygon)
Returns true if the edges of the given polygon intersect the edges of this polygon.double
getArea()
Returns the area of this polygon.AABB3d
getBoundingBox()
Returns the bounding box.MVector3d
getCentroid()
Returns the centroid of this polygon.default Iterator<Segment3d>
getEdgeIterator()
Returns an iterator that iterates through the segments in this polygon.MVector3d
getMean()
Returns the average vector of the vertices of this polygon.MVector3d
getNormal()
Returns the normal of this polygon as a vector of unit length.default int
getVertexCount()
Returns the number of vertices in this polygon.List<Vector3d>
getVertices()
Returns the vertices in this polygon.Optional<MVector3d>
intersect(Segment3d segment)
Returns the intersection point of this polygon and the given segment.default boolean
intersects(Segment3d segment)
Returns true if the given segment intersects this polygon.boolean
isConvex()
Returns true if this polygon is convex.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
contains
boolean contains(Polygon3d polygon)
Returns true if the given polygon is contained inside this polygon. The polygon needs to be completely inside this polygon, i.e., if the vertices or edges of the polygons intersect, then returns false.- Parameters:
polygon
- the polygon that is checked for containment inside this polygon- Returns:
- true if the given polygon is contained inside this polygon
- Since:
- 9.10.2
-
contains
boolean contains(Vector3d point)
Returns true if the given point is inside this polygon. If the point is on an edge of the polygon, then it is considered to be inside the polygon.- Parameters:
point
- the point that is checked for containment inside this polygon- Returns:
- true if the given point is inside this polygon
- Since:
- 9.10.2
-
edgesIntersect
boolean edgesIntersect(Polygon3d polygon)
Returns true if the edges of the given polygon intersect the edges of this polygon.- Parameters:
polygon
- true if the edges of the given polygon intersect the edges of this polygon- Returns:
- true if the edges of the given polygon intersect the edges of this polygon
- Since:
- 9.10.2
-
getArea
double getArea()
Returns the area of this polygon.- Returns:
- the area of this polygon
- Since:
- 9.10.2
-
getCentroid
MVector3d getCentroid()
Returns the centroid of this polygon. The centroid of a polygon is the average vector of the vertices.- Returns:
- the centroid of this polygon
- Since:
- 9.10.2
-
getBoundingBox
AABB3d getBoundingBox()
Returns the bounding box. The returned bounding box may be degenerate if the polygon is degenerate.- Returns:
- bounding box whose lower and upper points are the lower and upper points from the bounding box
- Since:
- 9.10.2
-
getEdgeIterator
default Iterator<Segment3d> getEdgeIterator()
Returns an iterator that iterates through the segments in this polygon.- Returns:
- an iterator that iterates through the segments in this polygon
- Since:
- 9.10.2
-
intersect
Optional<MVector3d> intersect(Segment3d segment)
Returns the intersection point of this polygon and the given segment. If the segment intersects the polygon at multiple points, then which point is returned is not specified. If the segment and polygon do not intersect, then returns empty.- Parameters:
segment
- the segment with which the intersection point is computed- Returns:
- the intersection point of this polygon and the given segment
- Since:
- 9.10.2
-
getMean
MVector3d getMean()
Returns the average vector of the vertices of this polygon.- Returns:
- the average vector of the vertices of this polygon
- Since:
- 9.10.2
-
getNormal
MVector3d getNormal()
Returns the normal of this polygon as a vector of unit length. Returns null if the normal cannot be computed, e.g., if the polygon is not planar.- Returns:
- the normal of this polygon as a vector of unit length
- Since:
- 9.10.2
-
getVertexCount
default int getVertexCount()
Returns the number of vertices in this polygon.- Returns:
- the number of vertices in this polygon
- Since:
- 9.10.2
-
getVertices
List<Vector3d> getVertices()
Returns the vertices in this polygon. Modifying the polygon through the list returned by this method is not supported.- Returns:
- the vertices in this polygon
- Since:
- 9.10.2
-
intersects
default boolean intersects(Segment3d segment)
Returns true if the given segment intersects this polygon.- Parameters:
segment
- the segment that is checked for intersection with this polygon- Returns:
- true if the given segment intersects this polygon
- Since:
- 9.10.2
-
isConvex
boolean isConvex()
Returns true if this polygon is convex.- Returns:
- true if this polygon is convex
- Since:
- 9.10.2
-
create
static Polygon3d create(Polygon3d polygon)
Creates a polygon with the contents deep copied from the given polygon. The returned polygon does not take ownership of the given polygon.- Parameters:
polygon
- the polygon whose contents are deep copied into the returned polygon- Returns:
- a polygon with the contents deep copied from the given polygon
- Since:
- 9.10.2
-
create
static Polygon3d create(List<? extends Vector3d> vertices)
Creates a polygon with the given vertices. The returned polygon does not take ownership of the given vertices.- Parameters:
vertices
- the vertices used for creating the returned polygon- Returns:
- a polygon with the given vertices
- Since:
- 9.10.2
-
-