44 #include <visp3/core/vpConfig.h> 50 #include <visp3/core/vpPolygon.h> 51 #include <visp3/mbt/vpMbtPolygon.h> 57 : index(-1), isvisible(false), isappearing(false), useLod(false), minLineLengthThresh(50.0),
58 minPolygonAreaThresh(2500.0), name(
""), hasOrientation(true)
121 std::vector<vpImagePoint> roiImagePoints;
124 if (roiImagePoints.size() == 2) {
125 double x1 = roiImagePoints[0].get_u();
126 double y1 = roiImagePoints[0].get_v();
127 double x2 = roiImagePoints[1].get_u();
128 double y2 = roiImagePoints[1].get_v();
129 double length = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
162 for (
unsigned int i = 0; i <
nbpt; i++) {
163 currentVertex =
p[i].
cP;
164 nextVertex =
p[(i + 1) % nbpt].cP;
166 faceNormal[0] += (currentVertex[1] - nextVertex[1]) * (currentVertex[2] + nextVertex[2]);
167 faceNormal[1] += (currentVertex[2] - nextVertex[2]) * (currentVertex[0] + nextVertex[0]);
168 faceNormal[2] += (currentVertex[0] - nextVertex[0]) * (currentVertex[1] + nextVertex[1]);
174 for (
unsigned int i = 0; i <
nbpt; i += 1) {
179 e4[0] = -pt.
get_X() / (double)nbpt;
180 e4[1] = -pt.
get_Y() / (double)nbpt;
181 e4[2] = -pt.
get_Z() / (double)nbpt;
189 if (angle < alpha || (modulo && (M_PI - angle) < alpha)) {
199 std::vector<vpImagePoint> roiImagePoints;
203 double area = roiPolygon.
getArea();
219 }
else if (modulo && (M_PI - angle) < alpha +
vpMath::rad(1)) {
void getRoiClipped(const vpCameraParameters &cam, std::vector< vpImagePoint > &roi)
Implements a 3D polygon with render functionnalities like clipping.
std::string name
Name of the polygon.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpPoint * p
corners in the object frame
vpMbtPolygon & operator=(const vpMbtPolygon &mbtp)
void set_X(const double X)
Set the point X coordinate in the camera frame.
Class that defines what is a point.
Defines a generic 2D polygon.
void changeFrame(const vpHomogeneousMatrix &cMo)
vpColVector & normalize()
void set_Z(const double Z)
Set the point Z coordinate in the camera frame.
double minLineLengthThresh
Implementation of a polygon of the model used by the model-based tracker.
void computePolygonClipped(const vpCameraParameters &cam=vpCameraParameters())
Generic class defining intrinsic camera parameters.
void set_Y(const double Y)
Set the point Y coordinate in the camera frame.
double minPolygonAreaThresh
vpPolygon3D & operator=(const vpPolygon3D &mbtp)
static double rad(double deg)
double get_X() const
Get the point X coordinate in the camera frame.
unsigned int nbpt
Number of points used to define the polygon.
bool isappearing
flag to specify whether the face is appearing or not
unsigned int getHeight() const
Implementation of column vector and the associated operations.
void setLod(const bool use_lod)
static double dotProd(const vpColVector &a, const vpColVector &b)
unsigned int clippingFlag
Clipping flag.
double get_Z() const
Get the point Z coordinate in the camera frame.
bool isvisible
flag to specify whether the face is visible or not
double get_Y() const
Get the point Y coordinate in the camera frame.
unsigned int getWidth() const
void computeFov(const unsigned int &w, const unsigned int &h)