jvx.geom

Class PnPolygon

• java.lang.Object
• jvx.geom.PnPolygon

• public class PnPolygon
extends java.lang.Object
Static methods that work on the geometry of polygons.
• Constructor Detail

• PnPolygon

public PnPolygon()
• 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.
• computeCurvature

public static PdVector computeCurvature(PgPolygon poly,
PdVector curvature,
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.
• computeCurvatureVectors

public static PdVector[] computeCurvatureVectors(PgPolygon poly,
PdVector[] out)
Computes the curvature vectors for a polygon.
Parameters:
poly - Polygon.
out - Output, resized to numVertices if smaller. May be null.
Returns:
Reference to parameter out (or newly allocated array). For each vertex, the result is a PdVector containing the curvature vector at this vertex.
• computeEdgeLengths

public static void computeEdgeLengths(PgPolygon poly,
PdVector es)
Computes the lengths of edges and stores them in the output array es.
• computeFrenetFrame

public static PgFrame[] computeFrenetFrame(PgPolygon poly,
PgFrame[] vertframe)
Computes the Frenet frame for a given polygon.
• 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
• computeParallelFrame

public static void computeParallelFrame(PgPolygon poly)
Adds a parallel frame as two vector fields to the polygon.
• computeFrenetFrame

public static void computeFrenetFrame(PgPolygon poly)
Adds a Frenet frame as two vector fields to the polygon.
• 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.