point.h
Go to the documentation of this file.
1 
8 #ifndef __POINT_H__
9 #define __POINT_H__
10 
11 #include <cmath>
12 #include <iostream>
13 using std::ostream;
14 using std::istream;
15 
16 #include <stdexcept>
17 using std::runtime_error;
18 
22 class Point {
23 
24 public:
28  inline Point() { x = y = z = 0.0; point_id = 0; type = 0; reflectance = 0.0; amplitude = 0.0; deviation = 0.0; rgb[0] = 255; rgb[1] = 255; rgb[2] = 255;};
32  inline Point(const Point& p) { x = p.x; y = p.y; z = p.z; type = p.type; point_id = p.point_id;
33  reflectance = p.reflectance; amplitude = p.amplitude; deviation = p.deviation; rgb[0] = p.rgb[0]; rgb[1] = p.rgb[1]; rgb[2] = p.rgb[2];};
37  inline Point(const double *p) { x = p[0]; y = p[1]; z = p[2]; type = 0; reflectance = 0.0; amplitude = 0.0; deviation = 0.0;
38  rgb[0] = 255; rgb[1] = 255; rgb[2] = 255;};
39  inline Point(const double *p, const char *c) { x = p[0]; y = p[1]; z = p[2]; rgb[0] = c[0]; rgb[1] = c[1]; rgb[2] = c[2];};
40 
44  inline Point(const double _x, const double _y, const double _z) { x = _x; y = _y; z = _z; };
45  inline Point(const double _x, const double _y, const double _z, const char _r, const char _g, const char _b) { x = _x; y = _y; z = _z; rgb[0] = _r; rgb[1] = _g; rgb[2] = _b;};
46 
47  static inline Point cross(const Point &X, const Point &Y) {
48  Point res;
49  res.x = X.y * Y.z - X.z * Y.y;
50  res.y = X.z * Y.x - X.x * Y.z;
51  res.z = X.x * Y.y - X.y * Y.x;
52  return res;
53  };
54 
55  static inline Point norm(const Point &p) {
56  double l = sqrt(p.x*p.x + p.y*p.y + p.z*p.z);
57  Point res(p.x/l, p.y/l, p.z/l);
58  return res;
59  };
60 
61  inline Point operator+(const Point &p) const {
62  Point res;
63  res.x = x + p.x;
64  res.y = y + p.y;
65  res.z = z + p.z;
66  return res;
67  };
68 
69  inline Point operator-(const Point &p) const {
70  Point res;
71  res.x = x - p.x;
72  res.y = y - p.y;
73  res.z = z - p.z;
74  return res;
75  };
76 
77  inline Point& operator-=(const Point &p) {
78  x -= p.x;
79  y -= p.y;
80  z -= p.z;
81  return *this;
82  };
83  inline Point& operator+=(const Point &p) {
84  x += p.x;
85  y += p.y;
86  z += p.z;
87  return *this;
88  };
89 
90 
91 
92  inline void transform(const double alignxf[16]);
93  inline double distance(const Point& p);
94  inline friend ostream& operator<<(ostream& os, const Point& p);
95  inline friend istream& operator>>(istream& is, Point& p);
96 
97  // also public; set/get functions not necessary here
99  double x;
101  double y;
103  double z;
106  int type;
107 
109  double rad;
111  double tan_theta;
112  // point id in points for veloscan , you can use it find point.
113  long point_id;
115 
116  // color information of the point between 0 and 255
117  // rgb
118  unsigned char rgb[3];
119 
120  float reflectance;
121  float amplitude;
122  float deviation;
123 };
124 
125 
126 inline Point operator*(const double &v, const Point &p) {
127  Point res;
128  res.x = v * p.x;
129  res.y = v * p.y;
130  res.z = v * p.z;
131  return res;
132 }
133 
134 #include "point.icc"
135 
136 #endif
Point::rad
double rad
Definition: point.h:109
Point::reflectance
float reflectance
Definition: point.h:120
Point::operator>>
friend istream & operator>>(istream &is, Point &p)
Point::operator<<
friend ostream & operator<<(ostream &os, const Point &p)
Point::amplitude
float amplitude
Definition: point.h:121
Point::operator+=
Point & operator+=(const Point &p)
Definition: point.h:83
Point::tan_theta
double tan_theta
tang in cylindrical coordinates for veloscan
Definition: point.h:111
Point::Point
Point(const double _x, const double _y, const double _z)
Definition: point.h:44
p
SharedPointer p
Definition: ConvertShared.hpp:42
Point::Point
Point(const double *p, const char *c)
Definition: point.h:39
Point::norm
static Point norm(const Point &p)
Definition: point.h:55
Point::operator-
Point operator-(const Point &p) const
Definition: point.h:69
operator*
Point operator*(const double &v, const Point &p)
Definition: point.h:126
Point::type
int type
Definition: point.h:106
Point::z
double z
z coordinate in 3D space
Definition: point.h:103
Point::distance
double distance(const Point &p)
Point::x
double x
x coordinate in 3D space
Definition: point.h:99
Point::operator+
Point operator+(const Point &p) const
Definition: point.h:61
Point::Point
Point()
Definition: point.h:28
Point::cross
static Point cross(const Point &X, const Point &Y)
Definition: point.h:47
Point::transform
void transform(const double alignxf[16])
Point::Point
Point(const Point &p)
Definition: point.h:32
Point::Point
Point(const double _x, const double _y, const double _z, const char _r, const char _g, const char _b)
Definition: point.h:45
Point::rgb
unsigned char rgb[3]
Definition: point.h:118
Point::Point
Point(const double *p)
Definition: point.h:37
Point::y
double y
y coordinate in 3D space
Definition: point.h:101
Point
Representation of a point in 3D space.
Definition: point.h:22
Point::point_id
long point_id
Definition: point.h:113
Point::deviation
float deviation
Definition: point.h:122
Point::operator-=
Point & operator-=(const Point &p)
Definition: point.h:77


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:24