Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

rsdl_dist.h

Go to the documentation of this file.
00001 #ifndef rsdl_dist_h_
00002 #define rsdl_dist_h_
00003 //:
00004 // \file
00005 // \brief Point to point and point to bounding box distance functions.
00006 // \author Chuck Stewart
00007 // \date June 2001
00008 //
00009 //  Distance functions for rsdl points and bounding boxes.  These
00010 //  points and bounding boxes have a mixture of cartesian and angular
00011 //  coordinates, so the computation is a little more complicated than
00012 //  ordinary Euclidean distance calculations.  Angles are treated in
00013 //  a full 2*pi range, so that the maximum distance between two angles
00014 //  is pi.  Also, bounding intervals on angles can be such that the
00015 //  numerical value on the "min" angle is greater than the numerical
00016 //  value on the "max" angle.  These are values that wrap-around 0.
00017 //
00018 //  Two assumptions are important.  First, it is assumed that all
00019 //  angles are truly within a 2*pi range; it doesn't matter which.
00020 //  This is an implementation (and efficiency) convenience.  Second,
00021 //  any normalization for comparing angle and cartesian distance
00022 //  measures has already been done.
00023 
00024 
00025 #include <rsdl/rsdl_point.h>
00026 #include <rsdl/rsdl_bounding_box.h>
00027 
00028 //: Return the square distance between two rsdl_point's.
00029 double
00030 rsdl_dist_sq( const rsdl_point & p, const rsdl_point& q );
00031 
00032 //: Return the distance between two rsdl_point's.
00033 double
00034 rsdl_dist( const rsdl_point & p, const rsdl_point& q );
00035 
00036 //: Return the minimum square distance between \a p and any point in \a b.
00037 double
00038 rsdl_dist_sq( const rsdl_point & p, const rsdl_bounding_box& b );
00039 
00040 //: Return the minimum distance between \a p and any point in \a b.
00041 double
00042 rsdl_dist( const rsdl_point & p, const rsdl_bounding_box& b );
00043 
00044 //: Determine if a point is inside a bounding box.
00045 bool
00046 rsdl_dist_point_in_box( const rsdl_point & pt,
00047                         const rsdl_bounding_box & box );
00048 
00049 
00050 //: Determine the relation between a proported "inner" box and a proported "outer" box.
00051 //  \a inside will be true iff all points in \a inner are in \a outer
00052 //  \a intersect will be true iff at least one point from \a inner is in \a outer.
00053 void
00054 rsdl_dist_box_relation( const rsdl_bounding_box & inner,
00055                         const rsdl_bounding_box & outer,
00056                         bool& inside,
00057                         bool& intersects );
00058 
00059 #endif

Generated on Thu Jan 10 14:49:34 2008 for contrib/rpl/rsdl by  doxygen 1.4.4