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)
122 std::vector<vpImagePoint> roiImagePoints;
125 if (roiImagePoints.size() == 2) {
126 double x1 = roiImagePoints[0].get_u();
127 double y1 = roiImagePoints[0].get_v();
128 double x2 = roiImagePoints[1].get_u();
129 double y2 = roiImagePoints[1].get_v();
130 double length = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
163 for (
unsigned int i = 0; i <
nbpt; i++) {
164 currentVertex =
p[i].
cP;
165 nextVertex =
p[(i + 1) % nbpt].cP;
167 faceNormal[0] += (currentVertex[1] - nextVertex[1]) * (currentVertex[2] + nextVertex[2]);
168 faceNormal[1] += (currentVertex[2] - nextVertex[2]) * (currentVertex[0] + nextVertex[0]);
169 faceNormal[2] += (currentVertex[0] - nextVertex[0]) * (currentVertex[1] + nextVertex[1]);
175 for (
unsigned int i = 0; i <
nbpt; i += 1) {
180 e4[0] = -pt.
get_X() / (double)nbpt;
181 e4[1] = -pt.
get_Y() / (double)nbpt;
182 e4[2] = -pt.
get_Z() / (double)nbpt;
190 if (angle < alpha || (modulo && (M_PI - angle) < alpha)) {
200 std::vector<vpImagePoint> roiImagePoints;
204 double area = roiPolygon.
getArea();
220 }
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.
unsigned int getWidth() const
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)
double get_Y() const
Get the point Y coordinate in the camera frame.
static double rad(double deg)
double get_Z() const
Get the point Z 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
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 getHeight() const
unsigned int clippingFlag
Clipping flag.
bool isvisible
flag to specify whether the face is visible or not
double get_X() const
Get the point X coordinate in the camera frame.
void computeFov(const unsigned int &w, const unsigned int &h)