CoordinateTransform.cpp
Go to the documentation of this file.
1 
28 /*
29  * CoordinateTransform.cpp
30  *
31  * Created on: 17.04.2012
32  * Author: Thomas Wiemann
33  */
34 
36 #include "lvr2/io/Timestamp.hpp"
37 
38 #include <boost/shared_ptr.hpp>
39 #include <iostream>
40 using std::cout;
41 using std::endl;
42 
43 namespace lvr2
44 {
45 
46 void convert(COORD_SYSTEM from, COORD_SYSTEM to, float* point)
47 {
48  if(from == OPENGL_METERS)
49  {
50  if(to == SLAM6D)
51  {
52  float x = point[0];
53  float y = point[1];
54  float z = point[2];
55 
56  point[0] = 100 * x;
57  point[1] = 100 * y;
58  point[2] = -100 * z;
59  }
60  else
61  {
62  cout << timestamp << "Target coordinate system not supported." << endl;
63  }
64  }
65  else
66  {
67  cout << timestamp << "Source coordinate system not supported." << endl;
68  }
69 }
70 
72 {
73  size_t n = buffer->numPoints();
74  floatArr p = buffer->getPointArray();
75  for(size_t i = 0; i < n; i++)
76  {
77  int pos = 3 * i;
78  float* point = &p[pos];
79  convert(OPENGL_METERS, SLAM6D, point);
80  }
81 }
82 
83 } // namespace lvr2
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Definition: Timestamp.hpp:116
std::shared_ptr< PointBuffer > PointBufferPtr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
SharedPointer p


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06