iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointCloud2PointSSEImpl.H
Go to the documentation of this file.
1 //NRT_HEADER_BEGIN
2 /*! @file PointCloud2/details/PointCloud2PointSSEImpl.H */
3 
4 // ////////////////////////////////////////////////////////////////////////
5 // The iLab Neuromorphic Robotics Toolkit (NRT) //
6 // Copyright 2010 by the University of Southern California (USC) and the //
7 // iLab at USC. //
8 // //
9 // iLab - University of Southern California //
10 // Hedco Neurociences Building, Room HNB-10 //
11 // Los Angeles, Ca 90089-2520 - USA //
12 // //
13 // See http://ilab.usc.edu for information about this project. //
14 // ////////////////////////////////////////////////////////////////////////
15 // This file is part of The iLab Neuromorphic Robotics Toolkit. //
16 // //
17 // The iLab Neuromorphic Robotics Toolkit is free software: you can //
18 // redistribute it and/or modify it under the terms of the GNU General //
19 // Public License as published by the Free Software Foundation, either //
20 // version 3 of the License, or (at your option) any later version. //
21 // //
22 // The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
23 // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
24 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
25 // PURPOSE. See the GNU General Public License for more details. //
26 // //
27 // You should have received a copy of the GNU General Public License //
28 // along with The iLab Neuromorphic Robotics Toolkit. If not, see //
29 // <http://www.gnu.org/licenses/>. //
30 // ////////////////////////////////////////////////////////////////////////
31 //
32 // Primary maintainer for this file: Shane Grant <wgrant@usc.edu>
33 //
34 //NRT_HEADER_END
35 
36 #ifndef NRT_POINTCLOUD2_DETAILS_POINTCLOUD2POINTSSEIMPL_H_
37 #define NRT_POINTCLOUD2_DETAILS_POINTCLOUD2POINTSSEIMPL_H_
38 
39 template<class T> inline
40 nrt::PointSSE<T>::PointSSE() : Point<T, 4>( 0, 0, 0, 0 )
41 {
42 }
43 
44 template<class T> inline
45 nrt::PointSSE<T>::PointSSE( T value, T w ) : Point<T, 4>( value, value, value, w )
46 {
47 }
48 
49 template<class T> inline
50 nrt::PointSSE<T>::PointSSE( T x, T y, T z, T w ) : Point<T, 4>(x, y, z, w)
51 { }
52 
53 template<class T> inline
54 nrt::PointSSE<T>::PointSSE( std::array<T, 3> const & init ) : Point<T, 4>()
55 {
56  (*this)[0] = init[0];
57  (*this)[1] = init[1];
58  (*this)[2] = init[2];
59  (*this)[3] = 0;
60 }
61 
62 template<class T> inline
63 nrt::PointSSE<T>::PointSSE( std::array<T, 4> const & init ) : Point<T, 4>( init )
64 { }
65 
66 template<class T> inline
67 nrt::PointSSE<T>::PointSSE( Point<T, 3> const & other ) : Point<T, 4>()
68 {
69  (*this)[0] = other[0];
70  (*this)[1] = other[1];
71  (*this)[2] = other[2];
72  (*this)[3] = 0;
73 }
74 
75 template <class T> inline
76 nrt::PointSSE<T>::PointSSE( Point<T, 4> const & other ) : Point<T, 4>( other )
77 { }
78 
79 template <class T>
80 template <class U> inline
81 nrt::PointSSE<T>::PointSSE( Point<U, 3> const & other ) : Point<T, 4>()
82 {
83  (*this)[0] = clamped_convert<T>( other[0] );
84  (*this)[1] = clamped_convert<T>( other[1] );
85  (*this)[2] = clamped_convert<T>( other[2] );
86  (*this)[3] = 0;
87 }
88 
89 template <class T>
90 template <class U> inline
91 nrt::PointSSE<T>::PointSSE( Point<U, 4> const & other ) : Point<T, 4>( other )
92 { }
93 
94 template <class T> inline
96 {
97  return (*this)[0];
98 }
99 
100 template <class T> inline
101 T const & nrt::PointSSE<T>::x() const
102 {
103  return (*this)[0];
104 }
105 
106 template <class T> inline
108 {
109  return (*this)[1];
110 }
111 
112 template <class T> inline
113 T const & nrt::PointSSE<T>::y() const
114 {
115  return (*this)[1];
116 }
117 
118 template <class T> inline
120 {
121  return (*this)[2];
122 }
123 
124 template <class T> inline
125 T const & nrt::PointSSE<T>::z() const
126 {
127  return (*this)[2];
128 }
129 
130 template <class T> inline
132 {
133  return (*this)[3];
134 }
135 
136 template <class T> inline
137 T const & nrt::PointSSE<T>::w() const
138 {
139  return (*this)[3];
140 }
141 
142 template <class T> inline
144 {
145  for( size_t i = 0; i < 4; ++i )
146  if( !std::isfinite( (*this)[i] ) )
147  return false;
148 
149  return true;
150 }
151 
152 template <class T> inline
153 auto nrt::PointSSE<T>::getVectorMap() -> Eigen::Map<Vector4, Eigen::Aligned>
154 {
155  return Vector4::MapAligned( &(this->itsData[0]), 4 );
156 }
157 
158 template <class T> inline
159 auto nrt::PointSSE<T>::getVectorMap() const -> Eigen::Map<const Vector4, Eigen::Aligned>
160 {
161  return Vector4::MapAligned( &(this->itsData[0]), 4 );
162 }
163 
164 template <class T> inline
165 auto nrt::PointSSE<T>::getVector3Map() -> Eigen::Map<Vector3, Eigen::Aligned>
166 {
167  return Vector3::MapAligned( &(this->itsData[0]), 3 );
168 }
169 
170 template <class T> inline
171 auto nrt::PointSSE<T>::getVector3Map() const -> Eigen::Map<const Vector3, Eigen::Aligned>
172 {
173  return Vector3::MapAligned( &(this->itsData[0]), 3 );
174 }
175 
176 #endif // NRT_POINTCLOUD2_DETAILS_POINTCLOUD2POINTSSEIMPL_H_