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
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
lvr2::COORD_SYSTEM
COORD_SYSTEM
Definition: CoordinateTransform.hpp:43
lvr2::SLAM6D
@ SLAM6D
Definition: CoordinateTransform.hpp:43
lvr2::PointBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
Definition: PointBuffer.hpp:130
CoordinateTransform.hpp
p
SharedPointer p
Definition: ConvertShared.hpp:42
lvr2::convert
void convert(COORD_SYSTEM from, COORD_SYSTEM to, float *point)
Definition: CoordinateTransform.cpp:46
lvr2::timestamp
static Timestamp timestamp
A global time stamp object for program runtime measurement.
Definition: Timestamp.hpp:116
lvr2::OPENGL_METERS
@ OPENGL_METERS
Definition: CoordinateTransform.hpp:43
lvr2
Definition: BaseBufferManipulators.hpp:39
Timestamp.hpp


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 Wed Mar 2 2022 00:37:23