EZC3D
Point.cpp
Go to the documentation of this file.
1 #define EZC3D_API_EXPORTS
2 
10 #include "Point.h"
11 
13 {
14  _data.resize(4);
15 }
16 
18 {
19  _data.resize(4);
20  x(p.x());
21  y(p.y());
22  z(p.z());
23  residual(0);
24 }
25 
27 {
28  std::cout << " Position = [" << x() << ", " << y() << ", " << z() << "]; Residual = " << residual() << std::endl;
29 }
30 
31 void ezc3d::DataNS::Points3dNS::Point::write(std::fstream &f) const
32 {
33  f.write(reinterpret_cast<const char*>(&_data[0]), ezc3d::DATA_TYPE::FLOAT);
34  f.write(reinterpret_cast<const char*>(&_data[1]), ezc3d::DATA_TYPE::FLOAT);
35  f.write(reinterpret_cast<const char*>(&_data[2]), ezc3d::DATA_TYPE::FLOAT);
36  f.write(reinterpret_cast<const char*>(&_data[3]), ezc3d::DATA_TYPE::FLOAT);
37 }
38 
39 const std::vector<float> ezc3d::DataNS::Points3dNS::Point::data() const
40 {
41  return _data;
42 }
43 
45 {
46  return _data;
47 }
48 
50 {
51  return _data[0];
52 }
53 
55 {
56  _data[0] = x;
57 }
58 
60 {
61  return _data[1];
62 }
63 
65 {
66  _data[1] = y;
67 }
68 
70 {
71  return _data[2];
72 }
73 
75 {
76  _data[2] = z;
77 }
78 
79 
81 {
82  return _data[3];
83 }
84 
86  _data[3] = residual;
87 }
88 
90 {
91  if (static_cast<double>(x()) == 0.0 &&
92  static_cast<double>(y()) == 0.0 &&
93  static_cast<double>(z()) == 0.0 &&
94  static_cast<double>(residual()) == 0.0)
95  return true;
96  else {
97  return false;
98  }
99 }
const std::vector< float > data() const
Get a reference to the STL vector where the 3D point is store.
Definition: Point.cpp:39
Declaration of Point class.
std::vector< float > _data
Value of the point.
Definition: Point.h:52
float y() const
Get the Y component of the 3D point.
Definition: Point.cpp:59
void print() const
Print the point.
Definition: Point.cpp:26
float residual() const
Get the residual component of the 3D point.
Definition: Point.cpp:80
float z() const
Get the Z component of the 3D point.
Definition: Point.cpp:69
Point()
Create an empty 3D point with memory allocated but not filled.
Definition: Point.cpp:12
std::vector< float > data_nonConst()
Get a reference to the STL vector where the 3D point is store in order to be modified by the caller...
Definition: Point.cpp:44
void write(std::fstream &f) const
Write the point to an opened file.
Definition: Point.cpp:31
float x() const
Get the X component of the 3D point.
Definition: Point.cpp:49
bool isempty() const
Return if the point is empty.
Definition: Point.cpp:89