public class Polygon3d extends java.lang.Object implements java.lang.Iterable<PolygonVertex3d>
Constructor and Description |
---|
Polygon3d() |
Polygon3d(java.util.Collection<? extends Point3d> pnts) |
Polygon3d(double[] coords) |
Polygon3d(Point3d[] pnts) |
Polygon3d(Polygon2d poly,
RigidTransform3d TPW) |
Modifier and Type | Method and Description |
---|---|
void |
addVertexAfter(PolygonVertex3d vtx,
PolygonVertex3d ref) |
void |
appendVertex(PolygonVertex3d vtx) |
void |
clear() |
Point3d |
computeCentroid()
Computes the centroid of the vertices of this polygon.
|
double |
computePlanarArea()
Computes the area of this contour with respect to a plane formed
by computing the centroid and then summing the cross products of
rays from the centroid to adjacent contour points.
|
boolean |
epsilonEquals(Polygon3d poly,
double eps)
Returns true if this polygon is equal to another polygon within a
prescribed tolerance eps.
|
boolean |
equals(Polygon3d poly)
Returns true if this polygon is equal to another polygon.
|
void |
getBounds(Point3d minValues,
Point3d maxValues) |
PolygonVertex3d |
getFirstVertex() |
PolygonVertex3d |
getLastVertex() |
double |
getMaxCoordinate() |
Point3d[] |
getPoints() |
java.util.ListIterator |
getVertices() |
void |
inverseTransform(AffineTransform3dBase X)
Applies an inverse affine transformation to the vertices of this polygon.
|
boolean |
isConvex(Vector3d nrml)
Returns
true if this 3d polygon is convex with respect
to the plane defined by the normal vector nrml . |
boolean |
isConvex(Vector3d nrml,
double angTol)
Returns
true if this 3d polygon is convex, within a presribed
angular tolerance, with respect to the plane defined by the normal vector
nrml . |
boolean |
isEmpty() |
java.util.Iterator<PolygonVertex3d> |
iterator() |
int |
numVertices() |
void |
prependVertex(PolygonVertex3d vtx) |
void |
scan(ReaderTokenizer rtok) |
<P extends Point3d> |
set(java.util.Collection<P> pnts) |
void |
set(double[] coords,
int numVertices) |
void |
set(Point3d[] pnts,
int numVertices) |
void |
set(Polygon3d poly) |
java.lang.String |
toString() |
java.lang.String |
toString(NumberFormat fmt) |
java.lang.String |
toString(java.lang.String fmtStr) |
void |
transform(AffineTransform3dBase X)
Applies a affine transformation to the vertices of this polygon.
|
void |
updateBounds(Point3d minValues,
Point3d maxValues) |
public Polygon3d()
public Polygon3d(double[] coords)
public Polygon3d(Point3d[] pnts)
public Polygon3d(java.util.Collection<? extends Point3d> pnts)
public Polygon3d(Polygon2d poly, RigidTransform3d TPW)
public java.util.ListIterator getVertices()
public java.util.Iterator<PolygonVertex3d> iterator()
iterator
in interface java.lang.Iterable<PolygonVertex3d>
public Point3d[] getPoints()
public double computePlanarArea()
public Point3d computeCentroid()
public int numVertices()
public double getMaxCoordinate()
public void addVertexAfter(PolygonVertex3d vtx, PolygonVertex3d ref)
public void appendVertex(PolygonVertex3d vtx)
public void prependVertex(PolygonVertex3d vtx)
public boolean isEmpty()
public PolygonVertex3d getLastVertex()
public PolygonVertex3d getFirstVertex()
public void clear()
public void set(Polygon3d poly)
public void set(double[] coords, int numVertices)
public void set(Point3d[] pnts, int numVertices)
public <P extends Point3d> void set(java.util.Collection<P> pnts)
public boolean isConvex(Vector3d nrml)
true
if this 3d polygon is convex with respect
to the plane defined by the normal vector nrml
.public boolean isConvex(Vector3d nrml, double angTol)
true
if this 3d polygon is convex, within a presribed
angular tolerance, with respect to the plane defined by the normal vector
nrml
.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String fmtStr)
public java.lang.String toString(NumberFormat fmt)
public void scan(ReaderTokenizer rtok) throws java.io.IOException
java.io.IOException
public boolean epsilonEquals(Polygon3d poly, double eps)
poly
- polygon to be compared witheps
- tolerance valueepsilonEquals(maspack.geometry.Polygon3d, double)
public boolean equals(Polygon3d poly)
poly
- polygon to be compared withepsilonEquals(maspack.geometry.Polygon3d, double)
public void transform(AffineTransform3dBase X)
X
- affine transformationpublic void inverseTransform(AffineTransform3dBase X)
X
- affine transformation