17 : m_maxArea(0), m_cloud(0), m_X(0), m_Y(1) {}
20 unsigned char zDim ) {
21 if (!
init(cloud, zDim))
return 0;
46 resultBox =
new ccBox(boxDim, &shiftMat,
"Biggest rect");
53 if (!cloud || cloud->
size() == 0) {
54 CVLog::Error(
"[ccInnerRect2DFinder] Invalid input cloud");
60 CVLog::Error(
"[ccInnerRect2DFinder] Invalid input cloud");
65 CVLog::Error(
"[ccInnerRect2DFinder] Invalid input parameter (zDim)");
69 unsigned char Z = zDim;
70 unsigned char X = ((Z + 1) % 3);
71 unsigned char Y = ((
X + 1) % 3);
83 for (
unsigned i = 1; i < pointCloud; ++i) {
101 unsigned startIndex) {
108 double minSquareDistToCenter = -1.0;
111 for (
unsigned i = startIndex; i < pointCount; ++i) {
116 double dist2 = (xc - P->
u[
m_X]) * (xc - P->
u[
m_X]) +
117 (yc - P->
u[
m_Y]) * (yc - P->
u[
m_Y]);
118 if (minSquareDistToCenter < 0) {
120 minSquareDistToCenter = dist2;
122 }
else if (dist2 < minSquareDistToCenter) {
124 minSquareDistToCenter = dist2;
134 double surf =
rect.area();
float PointCoordinateType
Type of the coordinates of a (N-D) point.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
void setTranslation(const Vector3Tpl< float > &Tr)
Sets translation (float version)
Float version of ccGLMatrixTpl.
A 3D cloud interface with associated features (color, normals, octree, etc.)
ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
Rect m_boundingRect
Global rectangle.
unsigned char m_X
X dimension.
ccInnerRect2DFinder()
Default constructor.
double m_maxArea
Inner rectangle max area.
ccGenericPointCloud * m_cloud
Associated cloud.
Rect m_maxRect
Inner rectangle.
bool init(ccGenericPointCloud *cloud, unsigned char zDim)
Initializes internal structures.
ccBox * process(ccGenericPointCloud *cloud, unsigned char zDim=2)
Finds the biggest enclosed rectangle.
void findBiggestRect(const Rect &rect, unsigned startIndex)
Internal processs.
unsigned char m_Y
Y dimension.
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Vector3Tpl< T > getCenter() const
Returns center.
bool isValid() const
Returns whether bounding box is valid or not.
virtual unsigned size() const =0
Returns the number of points.
virtual const CCVector3 * getPoint(unsigned index) const =0
Returns the ith point.