jvx.geom
Class PnPolygon
- java.lang.Object
-
- jvx.geom.PnPolygon
-
public class PnPolygon extends java.lang.ObjectStatic methods that work on the geometry of polygons.- Author:
- Eike Preuss
- Version:
- 02.08.2006, 1.10 (mn) Cleaned code.
28.09.2004, 1.00 (ep) Created.
-
-
Constructor Summary
Constructors Constructor and Description PnPolygon()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static PdVectorcomputeCurvature(PgPolygon poly, PdVector curvature, boolean integrated)Computes the curvature of the given polygon.static PdVectorcomputeCurvature(PgPolygon poly, PdVector curvature, double integrationRadius)Computes the curvature of the given polygon.static PdVector[]computeCurvatureVectors(PgPolygon poly, PdVector[] out)Computes the vertex-based curvature vectors for a polygon whose length is an approximation of the pointwise curvature via the tangens-formula: roughly like: curvature = length(edge)*tan(outerangle/2).static voidcomputeEdgeLengths(PgPolygon poly, PdVector es)Computes the lengths of edges and stores them in the output array es.static voidcomputeFrenetFrame(PgPolygon poly)Adds a Frenet frame as two vector fields to the polygon.static PgFrame[]computeFrenetFrame(PgPolygon poly, PgFrame[] vertframe)Computes the Frenet frame for a given polygon.static voidcomputeParallelFrame(PgPolygon poly)Adds a parallel frame as two vector fields to the polygon.static PgFrame[]computeParallelFrame(PgPolygon poly, PgFrame[] vertframe)Computes a parallel moving frame for the given polygon with 'random' initial frame.static voididentifyVertices(PgPolygon poly)Identifies successive vertices, whose distance is less than PuMath.EPS.static voididentifyVertices(PgPolygon poly, double eps)Identifies successive vertices, whose distance is less than eps.static voidreverse(PgPolygon polygon)Reverses the order of the vertices of a given polygon.
-
-
-
Method Detail
-
computeCurvature
public static PdVector computeCurvature(PgPolygon poly, PdVector curvature, boolean integrated)
Computes the curvature of the given polygon. It is the signed curvature if dim==2, otherwise it depends on correct vertex normals of the polygon.- Parameters:
poly- Polygon to compute the curvature of.curvature- Output. May be null. Resized to numVertices if smaller.integrated- If true, the integrated curvatures are calculated (length * k).- Returns:
- Parameter curvature or a newly allocated vector if parameter is null.
- Author:
- Matthias Nieser
- Version:
- 26.07.06, 1.00 created (mn)
-
computeCurvature
public static PdVector computeCurvature(PgPolygon poly, PdVector curvature, double integrationRadius)
Computes the curvature of the given polygon. It is the signed curvature if dim==2, otherwise it depends on correct vertex normals of the polygon. The curvatures are integrated values over an interval of given size around each vertex. Thus, the computed values are independent of the discretization of the polygon.- Parameters:
poly- Polygon to compute the curvature of.curvature- Output. May be null. Resized to numVertices if smaller.- Returns:
- Parameter curvature or a newly allocated vector if parameter is null.
- Author:
- Eike Preuss
-
computeCurvatureVectors
public static PdVector[] computeCurvatureVectors(PgPolygon poly, PdVector[] out)
Computes the vertex-based curvature vectors for a polygon whose length is an approximation of the pointwise curvature via the tangens-formula: roughly like: curvature = length(edge)*tan(outerangle/2).- Parameters:
poly- Polygon.out- Output, resized to numVertices if smaller. May benull.- Returns:
- Reference to parameter
out(or newly allocated array) which contains the vertex-based curvature vectors. - Author:
- Eike Preuss
- Version:
- 23.10.16, 2.50 revised (kp) Calculation simplified, doc added.
21.06.07, 2.00 revised (mn) Cleaned code and moved to PnPolygon.
1.00 created (ep)
-
computeEdgeLengths
public static void computeEdgeLengths(PgPolygon poly, PdVector es)
Computes the lengths of edges and stores them in the output array es.- Author:
- Matthias Nieser
- Version:
- 02.08.2006, 1.00 created (mn)
-
computeFrenetFrame
public static PgFrame[] computeFrenetFrame(PgPolygon poly, PgFrame[] vertframe)
Computes the Frenet frame for a given polygon.- Author:
- Eike Preuss
- Version:
- 08.02.2008 revised (kp) Method moved to dev.geom.PnPolygon from devKP.tebis.geom.PnFrenetFrame.
-
computeParallelFrame
public static PgFrame[] computeParallelFrame(PgPolygon poly, PgFrame[] vertframe)
Computes a parallel moving frame for the given polygon with 'random' initial frame. Edges may not be degenerated.- Parameters:
vertframe- output, resized to numVertices if smaller; may be null- Returns:
- reference to vertframe parameter or newly created array
- Author:
- Eike Preuss
-
computeParallelFrame
public static void computeParallelFrame(PgPolygon poly)
Adds a parallel frame as two vector fields to the polygon.- Author:
- Eike Preuss
-
computeFrenetFrame
public static void computeFrenetFrame(PgPolygon poly)
Adds a Frenet frame as two vector fields to the polygon.- Author:
- Eike Preuss
-
identifyVertices
public static void identifyVertices(PgPolygon poly)
Identifies successive vertices, whose distance is less than PuMath.EPS. If the first and last vertex are identified, the polygon gets closed.
-
identifyVertices
public static void identifyVertices(PgPolygon poly, double eps)
Identifies successive vertices, whose distance is less than eps. If the first and last vertex are identified, the polygon gets closed.
-
reverse
public static void reverse(PgPolygon polygon)
Reverses the order of the vertices of a given polygon.
-
-
"