ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PointData.h
Go to the documentation of this file.
1 // ##########################################################################
2 // # #
3 // # ACloudViewer WRAPPER: PoissonReconLib #
4 // # #
5 // # This program is free software; you can redistribute it and/or modify #
6 // # it under the terms of the GNU General Public License as published by #
7 // # the Free Software Foundation; version 2 or later of the License. #
8 // # #
9 // # This program is distributed in the hope that it will be useful, #
10 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 // # GNU General Public License for more details. #
13 // # #
14 // # COPYRIGHT: Daniel Girardeau-Montaut #
15 // # #
16 // ##########################################################################
17 
18 #ifndef POINTDATA_H
19 #define POINTDATA_H
20 
21 template <typename Real>
22 class PointData {
23 public:
24  PointData() : normal{0, 0, 0}, color{0, 0, 0} {}
25  PointData(const Real _normal[3], const Real _color[3], Real scale = 1.0) {
26  normal[0] = scale * _normal[0];
27  normal[1] = scale * _normal[1];
28  normal[2] = scale * _normal[2];
29  color[0] = scale * _color[0];
30  color[1] = scale * _color[1];
31  color[2] = scale * _color[2];
32  }
33 
34  PointData operator*(Real s) const { return PointData(normal, color, s); }
35 
36  PointData operator/(Real s) const {
37  return PointData(normal, color, 1 / s);
38  }
39 
41  normal[0] += d.normal[0];
42  normal[1] += d.normal[1];
43  normal[2] += d.normal[2];
44  color[0] += d.color[0];
45  color[1] += d.color[1];
46  color[2] += d.color[2];
47  return *this;
48  }
49  PointData& operator*=(Real s) {
50  normal[0] *= s;
51  normal[1] *= s;
52  normal[2] *= s;
53  color[0] *= s;
54  color[1] *= s;
55  color[2] *= s;
56  return *this;
57  }
58 
59 public:
60  Real normal[3];
61  Real color[3];
62 };
63 
64 extern template class PointData<float>;
65 extern template class PointData<double>;
66 
67 #endif // POINTDATA_H
PointData operator*(Real s) const
Definition: PointData.h:34
PointData(const Real _normal[3], const Real _color[3], Real scale=1.0)
Definition: PointData.h:25
Real normal[3]
Definition: PointData.h:60
PointData()
Definition: PointData.h:24
PointData & operator+=(const PointData &d)
Definition: PointData.h:40
Real color[3]
Definition: PointData.h:61
PointData operator/(Real s) const
Definition: PointData.h:36
PointData & operator*=(Real s)
Definition: PointData.h:49