Package org.robwork.sdurw_geometry
Class Contour2D
- java.lang.Object
-
- org.robwork.sdurw_geometry.Contour2D
-
public class Contour2D extends java.lang.Object
class representing a 2d contour
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Contour2D.Point
the point description of the contour
-
Constructor Summary
Constructors Constructor Description Contour2D()
constructorContour2D(long cPtr, boolean cMemoryOwn)
Contour2D(Vector2D center, SWIGTYPE_p_std__vectorT_rw__geometry__Contour2D__Point_t contour)
constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calcArea()
calculates the area of this contourstatic double
calcCentralMoments(Contour2D contour, Vector2D c, int r)
calculates the r'th central moments of the contourstatic Vector2D
calcCentroid(Contour2D contour)
calculates the centroid or the mean of the points in the contour.static Covariance
calcCovarianceMatrix(Contour2D contour, Vector2D c)
Calculates the covariance of the contour "contour" with mean coordinate
cstatic Vector2D
calcNormal(int idx, int pixelStep, Contour2D contour)
calculate normals of a contourstatic Vector2D
calcNormal(int idx, int pixelStep, Contour2D contour, boolean counterClock)
calculate normals of a contourstatic SWIGTYPE_p_rw__math__Rotation2DT_t
calcOrientation(Contour2D contour, Vector2D c)
calculates the orientation of a contour where the first
axis is the longest principal axis posible.static double
calcSequenceMoment(Contour2D contour, Vector2D c, int r)
calculates the r'th sequence moment of an ordered contourVector2D
center()
get contour centervoid
delete()
Contour2D.Point
get(long i)
static long
getCPtr(Contour2D obj)
static double
getCurvature(int idx, int pixelStep, Contour2D contour)
extracts the local curvature around the contour point
defined by idx.static Contour2DPtr
getOuterContour(Contour2D contour, double resolution)
extracts the outer contour of a contourSWIGTYPE_p_std__vectorT_rw__geometry__Contour2D__Point_t
points()
get contour point liststatic Contour2D
read(java.lang.String file)
reads a contour from filestatic void
recalcNormal(Contour2D contour)
recalculate normals of a contourvoid
set(long i, Contour2D.Point d)
long
size()
get nr of conout points on this contourTriMeshPtr
toTriMesh(double height)
A 3D geometry for a 2D contour of height height.
2D points (x,y) end up as (x, y, 0) in 3D.static void
write(Contour2D objC, java.lang.String file)
writes a contour to file
-
-
-
Constructor Detail
-
Contour2D
public Contour2D(long cPtr, boolean cMemoryOwn)
-
Contour2D
public Contour2D()
constructor
-
Contour2D
public Contour2D(Vector2D center, SWIGTYPE_p_std__vectorT_rw__geometry__Contour2D__Point_t contour)
constructor- Parameters:
center
-contour
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(Contour2D obj)
-
delete
public void delete()
-
size
public long size()
get nr of conout points on this contour- Returns:
- number of points
-
get
public Contour2D.Point get(long i)
-
set
public void set(long i, Contour2D.Point d)
-
calcArea
public double calcArea()
calculates the area of this contour
-
center
public Vector2D center()
get contour center
-
points
public SWIGTYPE_p_std__vectorT_rw__geometry__Contour2D__Point_t points()
get contour point list
-
write
public static void write(Contour2D objC, java.lang.String file)
writes a contour to file- Parameters:
objC
- [in] contour to write to filefile
- [in] name of file
-
read
public static Contour2D read(java.lang.String file)
reads a contour from file- Parameters:
file
-- Returns:
- a contour
-
calcSequenceMoment
public static double calcSequenceMoment(Contour2D contour, Vector2D c, int r)
calculates the r'th sequence moment of an ordered contour- Parameters:
contour
- [in]c
- [in] centerr
- [in]
-
calcCentralMoments
public static double calcCentralMoments(Contour2D contour, Vector2D c, int r)
calculates the r'th central moments of the contour- Parameters:
contour
-c
- [in] centerr
- [in]- Returns:
- the moment
-
calcCovarianceMatrix
public static Covariance calcCovarianceMatrix(Contour2D contour, Vector2D c)
Calculates the covariance of the contour "contour" with mean coordinate
c- Parameters:
contour
- [in] the contourc
- [in] the mean of the contour points/coordinates- Returns:
- the 2x2 covariance matrix of the contour
-
calcOrientation
public static SWIGTYPE_p_rw__math__Rotation2DT_t calcOrientation(Contour2D contour, Vector2D c)
calculates the orientation of a contour where the first
axis is the longest principal axis posible.
-
calcCentroid
public static Vector2D calcCentroid(Contour2D contour)
calculates the centroid or the mean of the points in the contour.
-
getCurvature
public static double getCurvature(int idx, int pixelStep, Contour2D contour)
extracts the local curvature around the contour point
defined by idx.
-
calcNormal
public static Vector2D calcNormal(int idx, int pixelStep, Contour2D contour, boolean counterClock)
calculate normals of a contour- Parameters:
idx
-pixelStep
-contour
-counterClock
-- Returns:
- contour normal
-
calcNormal
public static Vector2D calcNormal(int idx, int pixelStep, Contour2D contour)
calculate normals of a contour- Parameters:
idx
-pixelStep
-contour
-
- Returns:
- contour normal
-
recalcNormal
public static void recalcNormal(Contour2D contour)
recalculate normals of a contour- Parameters:
contour
-
-
getOuterContour
public static Contour2DPtr getOuterContour(Contour2D contour, double resolution)
extracts the outer contour of a contour- Parameters:
contour
- [in] contour to find outer contour of.resolution
- [in] the resolution.- Returns:
- new contour
-
toTriMesh
public TriMeshPtr toTriMesh(double height)
A 3D geometry for a 2D contour of height height.
2D points (x,y) end up as (x, y, 0) in 3D.
-
-