Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PCL_GEOMETRY_H_
00039 #define PCL_GEOMETRY_H_
00040
00041 #if defined __GNUC__
00042 # pragma GCC system_header
00043 #endif
00044
00045 #include <Eigen/Core>
00046
00054 namespace pcl
00055 {
00056 namespace geometry
00057 {
00059 template <typename PointT> inline float
00060 distance (const PointT& p1, const PointT& p2)
00061 {
00062 Eigen::Vector3f diff = p1 -p2;
00063 return (diff.norm ());
00064 }
00065
00067 template<typename PointT> inline float
00068 squaredDistance (const PointT& p1, const PointT& p2)
00069 {
00070 Eigen::Vector3f diff = p1 -p2;
00071 return (diff.squaredNorm ());
00072 }
00073
00080 template<typename PointT, typename NormalT> inline void
00081 project (const PointT& point, const PointT &plane_origin,
00082 const NormalT& plane_normal, PointT& projected)
00083 {
00084 Eigen::Vector3f po = point - plane_origin;
00085 const Eigen::Vector3f normal = plane_normal.getVector3fMapConst ();
00086 float lambda = normal.dot(po);
00087 projected.getVector3fMap () = point.getVector3fMapConst () - (lambda * normal);
00088 }
00089
00096 inline void
00097 project (const Eigen::Vector3f& point, const Eigen::Vector3f &plane_origin,
00098 const Eigen::Vector3f& plane_normal, Eigen::Vector3f& projected)
00099 {
00100 Eigen::Vector3f po = point - plane_origin;
00101 float lambda = plane_normal.dot(po);
00102 projected = point - (lambda * plane_normal);
00103 }
00104 }
00105 }
00106
00108 #endif //#ifndef PCL_GEOMETRY_H_