42 #include <visp3/core/vpConfig.h>
48 #include <visp3/core/vpPolygon.h>
49 #include <visp3/mbt/vpMbtPolygon.h>
56 : index(-1), isvisible(false), isappearing(false), useLod(false), minLineLengthThresh(50.0),
57 minPolygonAreaThresh(2500.0), name(
""), hasOrientation(true)
61 :
vpPolygon3D(mbtp), index(mbtp.index), isvisible(mbtp.isvisible), isappearing(mbtp.isappearing), useLod(mbtp.useLod),
62 minLineLengthThresh(mbtp.minLineLengthThresh), minPolygonAreaThresh(mbtp.minPolygonAreaThresh), name(mbtp.name),
63 hasOrientation(mbtp.hasOrientation)
114 std::vector<vpImagePoint> roiImagePoints;
117 if (roiImagePoints.size() == 2) {
118 double x1 = roiImagePoints[0].get_u();
119 double y1 = roiImagePoints[0].get_v();
120 double x2 = roiImagePoints[1].get_u();
121 double y2 = roiImagePoints[1].get_v();
122 double length = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
155 for (
unsigned int i = 0; i <
nbpt; i++) {
156 currentVertex =
p[i].
cP;
157 nextVertex =
p[(i + 1) %
nbpt].cP;
159 faceNormal[0] += (currentVertex[1] - nextVertex[1]) * (currentVertex[2] + nextVertex[2]);
160 faceNormal[1] += (currentVertex[2] - nextVertex[2]) * (currentVertex[0] + nextVertex[0]);
161 faceNormal[2] += (currentVertex[0] - nextVertex[0]) * (currentVertex[1] + nextVertex[1]);
167 for (
unsigned int i = 0; i <
nbpt; i += 1) {
182 if (angle < alpha || (modulo && (M_PI - angle) < alpha)) {
192 std::vector<vpImagePoint> roiImagePoints;
196 double area = roiPolygon.
getArea();
213 else if (modulo && (M_PI - angle) < alpha +
vpMath::rad(1)) {
Generic class defining intrinsic camera parameters.
void computeFov(const unsigned int &w, const unsigned int &h)
Implementation of column vector and the associated operations.
static double dotProd(const vpColVector &a, const vpColVector &b)
vpColVector & normalize()
Implementation of an homogeneous matrix and operations on such kind of matrices.
static double rad(double deg)
Implementation of a polygon of the model used by the model-based tracker.
bool isvisible
flag to specify whether the face is visible or not
double minLineLengthThresh
void setLod(bool use_lod)
double minPolygonAreaThresh
bool isappearing
flag to specify whether the face is appearing or not
std::string name
Name of the polygon.
vpMbtPolygon & operator=(const vpMbtPolygon &mbtp)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double get_Y() const
Get the point cY coordinate in the camera frame.
void set_X(double cX)
Set the point cX coordinate in the camera frame.
void set_Y(double cY)
Set the point cY coordinate in the camera frame.
double get_Z() const
Get the point cZ coordinate in the camera frame.
void set_Z(double cZ)
Set the point cZ coordinate in the camera frame.
double get_X() const
Get the point cX coordinate in the camera frame.
Implements a 3D polygon with render functionalities like clipping.
void changeFrame(const vpHomogeneousMatrix &cMo)
unsigned int nbpt
Number of points used to define the polygon.
vpPoint * p
corners in the object frame
void computePolygonClipped(const vpCameraParameters &cam=vpCameraParameters())
unsigned int clippingFlag
Clipping flag.
void getRoiClipped(const vpCameraParameters &cam, std::vector< vpImagePoint > &roi)
vpPolygon3D & operator=(const vpPolygon3D &mbtp)
Defines a generic 2D polygon.