40#include <visp3/core/vpConfig.h>
46#include <visp3/core/vpPolygon.h>
47#include <visp3/mbt/vpMbtPolygon.h>
113 std::vector<vpImagePoint> roiImagePoints;
116 if (roiImagePoints.size() == 2) {
117 double x1 = roiImagePoints[0].get_u();
118 double y1 = roiImagePoints[0].get_v();
119 double x2 = roiImagePoints[1].get_u();
120 double y2 = roiImagePoints[1].get_v();
121 double length = std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
154 for (
unsigned int i = 0; i <
nbpt; i++) {
155 currentVertex =
p[i].cP;
156 nextVertex =
p[(i + 1) %
nbpt].cP;
158 faceNormal[0] += (currentVertex[1] - nextVertex[1]) * (currentVertex[2] + nextVertex[2]);
159 faceNormal[1] += (currentVertex[2] - nextVertex[2]) * (currentVertex[0] + nextVertex[0]);
160 faceNormal[2] += (currentVertex[0] - nextVertex[0]) * (currentVertex[1] + nextVertex[1]);
166 for (
unsigned int i = 0; i <
nbpt; i += 1) {
171 e4[0] = -pt.
get_X() /
static_cast<double>(
nbpt);
172 e4[1] = -pt.
get_Y() /
static_cast<double>(
nbpt);
173 e4[2] = -pt.
get_Z() /
static_cast<double>(
nbpt);
181 if (angle < alpha || (modulo && (M_PI - angle) < alpha)) {
191 std::vector<vpImagePoint> roiImagePoints;
195 double area = roiPolygon.
getArea();
212 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)
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.
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.