comp_geometry.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2013, Georgia Institute of Technology
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the Georgia Institute of Technology nor the names of
00018  *     its contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************/
00034 #ifndef cpl_comp_geometry_h_DEFINED
00035 #define cpl_comp_geometry_h_DEFINED
00036 
00037 #include <ros/ros.h>
00038 #include <pcl16/point_cloud.h>
00039 #include <pcl16/point_types.h>
00040 #include <geometry_msgs/PointStamped.h>
00041 
00042 namespace cpl_visual_features
00043 {
00044 
00045 bool lineSegmentIntersection2D(pcl16::PointXYZ a1, pcl16::PointXYZ a2, pcl16::PointXYZ b1, pcl16::PointXYZ b2,
00046                                pcl16::PointXYZ& intersection);
00047 
00048 bool lineLineIntersection2D(pcl16::PointXYZ a1, pcl16::PointXYZ a2, pcl16::PointXYZ b1, pcl16::PointXYZ b2,
00049                             pcl16::PointXYZ& intersection);
00050 
00051 bool pointIsBetweenOthers(pcl16::PointXYZ& pt, pcl16::PointXYZ& x1, pcl16::PointXYZ& x2);
00052 
00053 double pointLineDistance2D(pcl16::PointXYZ& pt, pcl16::PointXYZ& a, pcl16::PointXYZ& b);
00054 
00055 static inline double dist(pcl16::PointXYZ a, pcl16::PointXYZ b)
00056 {
00057   const double dx = a.x-b.x;
00058   const double dy = a.y-b.y;
00059   const double dz = a.z-b.z;
00060   return std::sqrt(dx*dx+dy*dy+dz*dz);
00061 }
00062 
00063 static inline double dist(pcl16::PointXYZ a, geometry_msgs::Point b)
00064 {
00065   const double dx = a.x-b.x;
00066   const double dy = a.y-b.y;
00067   const double dz = a.z-b.z;
00068   return std::sqrt(dx*dx+dy*dy+dz*dz);
00069 }
00070 
00071 static inline double dist(geometry_msgs::Point b, pcl16::PointXYZ a)
00072 {
00073   return dist(a,b);
00074 }
00075 
00076 static inline double sqrDist(Eigen::Vector3f& a, pcl16::PointXYZ& b)
00077 {
00078   const double dx = a[0]-b.x;
00079   const double dy = a[1]-b.y;
00080   const double dz = a[2]-b.z;
00081   return dx*dx+dy*dy+dz*dz;
00082 }
00083 
00084 
00085 static inline double sqrDist(Eigen::Vector4f& a, Eigen::Vector4f& b)
00086 {
00087   const double dx = a[0]-b[0];
00088   const double dy = a[1]-b[1];
00089   const double dz = a[2]-b[2];
00090   return dx*dx+dy*dy+dz*dz;
00091 }
00092 
00093 static inline double sqrDist(pcl16::PointXYZ a, pcl16::PointXYZ b)
00094 {
00095   const double dx = a.x-b.x;
00096   const double dy = a.y-b.y;
00097   const double dz = a.z-b.z;
00098   return dx*dx+dy*dy+dz*dz;
00099 }
00100 
00101 static inline double sqrDistXY(pcl16::PointXYZ a, pcl16::PointXYZ b)
00102 {
00103   const double dx = a.x-b.x;
00104   const double dy = a.y-b.y;
00105   return dx*dx+dy*dy;
00106 }
00107 
00108 };
00109 #endif // cpl_comp_geometry_h_DEFINED


cpl_visual_features
Author(s): Tucker Hermans
autogenerated on Wed Nov 27 2013 11:52:35