40 #include <visp3/core/vpFeatureDisplay.h>
41 #include <visp3/core/vpPoint.h>
46 const unsigned int index_2 = 2;
47 const unsigned int index_3 = 3;
113 const unsigned int index_0 = 0;
114 const unsigned int index_1 = 1;
115 const unsigned int index_2 = 2;
116 const unsigned int index_3 = 3;
135 const unsigned int index_0 = 0;
136 const unsigned int index_1 = 1;
137 const unsigned int index_2 = 2;
138 const unsigned int index_3 = 3;
139 const unsigned int val_3 = 3;
140 const unsigned int val_4 = 4;
142 if (oP_.
size() == val_3) {
143 oP[index_0] = oP_[index_0];
144 oP[index_1] = oP_[index_1];
145 oP[index_2] = oP_[index_2];
148 else if (oP_.
size() == val_4) {
149 oP[index_0] = oP_[index_0];
150 oP[index_1] = oP_[index_1];
151 oP[index_2] = oP_[index_2];
152 oP[index_3] = oP_[index_3];
172 const unsigned int index_0 = 0;
173 const unsigned int index_1 = 1;
174 const unsigned int index_2 = 2;
175 const unsigned int index_3 = 3;
176 const unsigned int val_3 = 3;
177 const unsigned int val_4 = 4;
179 if (oP_.size() == val_3) {
180 oP[index_0] = oP_[index_0];
181 oP[index_1] = oP_[index_1];
182 oP[index_2] = oP_[index_2];
185 else if (oP_.size() == val_4) {
186 oP[index_0] = oP_[index_0];
187 oP[index_1] = oP_[index_1];
188 oP[index_2] = oP_[index_2];
189 oP[index_3] = oP_[index_3];
200 const unsigned int index_0 = 0;
201 const unsigned int index_1 = 1;
202 const unsigned int index_2 = 2;
225 unsigned int oP_size =
oP.
size();
226 for (
unsigned int i = 0; i < oP_size; ++i) {
249 const unsigned int index_0 = 0;
250 const unsigned int index_1 = 1;
251 const unsigned int index_2 = 2;
254 v_p[index_0] = v_cP[index_0] / v_cP[index_2];
255 v_p[index_1] = v_cP[index_1] / v_cP[index_2];
269 const unsigned int index_0 = 0;
270 const unsigned int index_1 = 1;
271 const unsigned int index_2 = 2;
272 const unsigned int index_3 = 3;
275 v_cP[index_0] = (cMo[index_0][index_0] *
oP[index_0]) + (cMo[index_0][index_1] *
oP[index_1]) + (cMo[index_0][index_2] *
oP[index_2]) + (cMo[index_0][index_3] *
oP[index_3]);
276 v_cP[index_1] = (cMo[index_1][index_0] *
oP[index_0]) + (cMo[index_1][index_1] *
oP[index_1]) + (cMo[index_1][index_2] *
oP[index_2]) + (cMo[index_1][index_3] *
oP[index_3]);
277 v_cP[index_2] = (cMo[index_2][index_0] *
oP[index_0]) + (cMo[index_2][index_1] *
oP[index_1]) + (cMo[index_2][index_2] *
oP[index_2]) + (cMo[index_2][index_3] *
oP[index_3]);
278 v_cP[index_3] = (cMo[index_3][index_0] *
oP[index_0]) + (cMo[index_3][index_1] *
oP[index_1]) + (cMo[index_3][index_2] *
oP[index_2]) + (cMo[index_3][index_3] *
oP[index_3]);
280 double d = 1 / v_cP[index_3];
297 const unsigned int index_0 = 0;
298 const unsigned int index_1 = 1;
299 const unsigned int index_2 = 2;
300 const unsigned int index_3 = 3;
301 double X = (cMo[index_0][index_0] *
oP[index_0]) + (cMo[index_0][index_1] *
oP[index_1]) + (cMo[index_0][index_2] *
oP[index_2]) + (cMo[index_0][index_3] *
oP[index_3]);
302 double Y = (cMo[index_1][index_0] *
oP[index_0]) + (cMo[index_1][index_1] *
oP[index_1]) + (cMo[index_1][index_2] *
oP[index_2]) + (cMo[index_1][index_3] *
oP[index_3]);
303 double Z = (cMo[index_2][index_0] *
oP[index_0]) + (cMo[index_2][index_1] *
oP[index_1]) + (cMo[index_2][index_2] *
oP[index_2]) + (cMo[index_2][index_3] *
oP[index_3]);
304 double W = (cMo[index_3][index_0] *
oP[index_0]) + (cMo[index_3][index_1] *
oP[index_1]) + (cMo[index_3][index_2] *
oP[index_2]) + (cMo[index_3][index_3] *
oP[index_3]);
332 const vpColor &color,
unsigned int thickness)
336 const unsigned int index_2 = 2;
338 if (v_cP[index_2] < 0) {
358 const vpColor &color,
unsigned int thickness)
362 const unsigned int index_2 = 2;
364 if (v_cP[index_2] < 0) {
381 unsigned int thickness)
395 unsigned int thickness)
436 const unsigned int index_0 = 0;
437 const unsigned int index_1 = 1;
438 const unsigned int index_2 = 2;
439 double d = 1 /
cP[index_2];
440 p[index_0] =
cP[index_0] * d;
441 p[index_1] =
cP[index_1] * d;
470 VISP_EXPORT std::ostream &
operator<<(std::ostream &os,
const vpPoint & ) {
return (os <<
"vpPoint"); }
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
unsigned int size() const
Return the number of elements of the 2D array.
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
static void displayPoint(double x, double y, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double get_oW() const
Get the point oW coordinate in the object frame.
double get_oX() const
Get the point oX coordinate in the object frame.
double get_w() const
Get the point w coordinate in the image plane.
void set_x(double x)
Set the point x coordinate in the image plane.
void set_W(double cW)
Set the point cW coordinate in the camera frame.
void set_oW(double oW)
Set the point oW coordinate in the object frame.
double get_y() const
Get the point y coordinate in the image plane.
double get_Y() const
Get the point cY coordinate in the camera frame.
double get_oZ() const
Get the point oZ coordinate in the object frame.
void set_oY(double oY)
Set the point oY coordinate in the object frame.
void set_X(double cX)
Set the point cX coordinate in the camera frame.
double get_x() const
Get the point x coordinate in the image plane.
double get_W() const
Get the point cW coordinate in the camera frame.
void set_Y(double cY)
Set the point cY coordinate in the camera frame.
void init() VP_OVERRIDE
Basic construction.
double get_Z() const
Get the point cZ coordinate in the camera frame.
void display(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1) VP_OVERRIDE
void set_oZ(double oZ)
Set the point oZ coordinate in the object frame.
vpColVector getWorldCoordinates(void)
void set_Z(double cZ)
Set the point cZ coordinate in the camera frame.
vpPoint * duplicate() const VP_OVERRIDE
For memory issue (used by the vpServo class only).
void set_oX(double oX)
Set the point oX coordinate in the object frame.
double get_oY() const
Get the point oY coordinate in the object frame.
void projection() VP_OVERRIDE
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const VP_OVERRIDE
double get_X() const
Get the point cX coordinate in the camera frame.
vpPoint()
Basic constructor.
void setWorldCoordinates(double oX, double oY, double oZ)
void set_y(double y)
Set the point y coordinate in the image plane.
void set_w(double w)
Set the point w coordinate in the image plane.