Package org.robwork.sdurw_geometry
Class Contour2DPtr
- java.lang.Object
-
- org.robwork.sdurw_geometry.Contour2DPtr
-
public class Contour2DPtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description Contour2DPtr()
Default constructor yielding a NULL-pointer.Contour2DPtr(long cPtr, boolean cMemoryOwn)
Contour2DPtr(Contour2D ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Contour2D
__ref__()
Dereferencing operator.double
calcArea()
calculates the area of this contourdouble
calcCentralMoments(Contour2D contour, Vector2D c, int r)
calculates the r'th central moments of the contourVector2D
calcCentroid(Contour2D contour)
calculates the centroid or the mean of the points in the contour.Covariance
calcCovarianceMatrix(Contour2D contour, Vector2D c)
Calculates the covariance of the contour "contour" with mean coordinate
cVector2D
calcNormal(int idx, int pixelStep, Contour2D contour)
calculate normals of a contourVector2D
calcNormal(int idx, int pixelStep, Contour2D contour, boolean counterClock)
calculate normals of a contourSWIGTYPE_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.double
calcSequenceMoment(Contour2D contour, Vector2D c, int r)
calculates the r'th sequence moment of an ordered contourVector2D
center()
get contour centerContour2DCPtr
cptr()
void
delete()
Contour2D
deref()
The pointer stored in the object.boolean
equals(Contour2D p)
Contour2D.Point
get(long i)
static long
getCPtr(Contour2DPtr obj)
double
getCurvature(int idx, int pixelStep, Contour2D contour)
extracts the local curvature around the contour point
defined by idx.Contour2D
getDeref()
Member access operator.Contour2DPtr
getOuterContour(Contour2D contour, double resolution)
extracts the outer contour of a contourboolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipSWIGTYPE_p_std__vectorT_rw__geometry__Contour2D__Point_t
points()
get contour point listContour2D
read(java.lang.String file)
reads a contour from filevoid
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.void
write(Contour2D objC, java.lang.String file)
writes a contour to file
-
-
-
Constructor Detail
-
Contour2DPtr
public Contour2DPtr(long cPtr, boolean cMemoryOwn)
-
Contour2DPtr
public Contour2DPtr()
Default constructor yielding a NULL-pointer.
-
Contour2DPtr
public Contour2DPtr(Contour2D ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(Contour2DPtr obj)
-
delete
public void delete()
-
deref
public Contour2D deref()
The pointer stored in the object.
-
__ref__
public Contour2D __ref__()
Dereferencing operator.
-
getDeref
public Contour2D getDeref()
Member access operator.
-
equals
public boolean equals(Contour2D p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
cptr
public Contour2DCPtr cptr()
-
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 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 Contour2D read(java.lang.String file)
reads a contour from file- Parameters:
file
-- Returns:
- a contour
-
calcSequenceMoment
public 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 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 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 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 Vector2D calcCentroid(Contour2D contour)
calculates the centroid or the mean of the points in the contour.
-
getCurvature
public double getCurvature(int idx, int pixelStep, Contour2D contour)
extracts the local curvature around the contour point
defined by idx.
-
calcNormal
public 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 Vector2D calcNormal(int idx, int pixelStep, Contour2D contour)
calculate normals of a contour- Parameters:
idx
-pixelStep
-contour
-
- Returns:
- contour normal
-
recalcNormal
public void recalcNormal(Contour2D contour)
recalculate normals of a contour- Parameters:
contour
-
-
getOuterContour
public 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.
-
-