geometry.h
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 #ifndef PCL_GEOMETRY_H_
00038 #define PCL_GEOMETRY_H_
00039
00040 #include <pcl/common/eigen.h>
00041
00049 namespace pcl
00050 {
00051 namespace geometry
00052 {
00054 template<typename PointT>
00055 inline float distance( const PointT& p1, const PointT& p2)
00056 {
00057 Eigen::Vector3f diff = p1 -p2;
00058 return diff.norm ();
00059 }
00061 template<typename PointT>
00062 inline float squaredDistance( const PointT& p1, const PointT& p2)
00063 {
00064 Eigen::Vector3f diff = p1 -p2;
00065 return diff.squaredNorm ();
00066 }
00073 template<typename PointT, typename NormalT>
00074 inline void project(const PointT& point, const PointT &plane_origin, const NormalT& plane_normal, PointT& projected)
00075 {
00076 Eigen::Vector3f po = point - plane_origin;
00077 const Eigen::Vector3f normal = plane_normal.getVector3fMapConst ();
00078 float lambda = normal.dot(po);
00079 projected.getVector3fMap () = point.getVector3fMapConst () - (lambda * normal);
00080 }
00087 inline void project(const Eigen::Vector3f& point, const Eigen::Vector3f &plane_origin, const Eigen::Vector3f& plane_normal, Eigen::Vector3f& projected)
00088 {
00089 Eigen::Vector3f po = point - plane_origin;
00090 float lambda = plane_normal.dot(po);
00091 projected = point - (lambda * plane_normal);
00092 }
00093 }
00094 }
00095
00097 #endif //#ifndef PCL_GEOMETRY_H_