contrib/gel/vmal/vmal_operators.h
Go to the documentation of this file.
00001 // This is gel/vmal/vmal_operators.h
00002 #ifndef vmal_operators_h_
00003 #define vmal_operators_h_
00004 //--------------------------------------------------------------------------------
00005 //:
00006 //  \file
00007 //
00008 // \author
00009 //   L. Guichard
00010 // \verbatim
00011 // Modifications:
00012 //   Feb.2002 - Peter Vanroose - brief doxygen comment placed on single line
00013 // \endverbatim
00014 //--------------------------------------------------------------------------------
00015 #include <vnl/vnl_double_3.h>
00016 
00017 class vmal_operators
00018 {
00019  public:
00020 
00021   vmal_operators();
00022 
00023   ~vmal_operators();
00024 //-----------------------------------------------------------------------------
00025 //: Project the point (x0,y0) on the segment [(ax,ay),(bx,by)].
00026 // (x,y) is the projected point.  It returns the orthogonal distance.
00027 // (x,y)=(-1,-1) if the projected point does not belong to the segment.
00028 //-----------------------------------------------------------------------------
00029   static double project_point(double x0,double y0,
00030                               double ax,double ay,
00031                               double bx,double by,
00032                               double *x,double *y);
00033 
00034 //-----------------------------------------------------------------------------
00035 //: Project the point x on the segment [a,b].
00036 // px is the projected point. It returns the orthogonal distance.
00037 // px=(-1,-1) if the projected point does not belong to the segment.
00038 //-----------------------------------------------------------------------------
00039   static bool project_point(vnl_double_3 &x,
00040                             vnl_double_3 &a,
00041                             vnl_double_3 &b,
00042                             vnl_double_3 &px);
00043 
00044 //-----------------------------------------------------------------------------
00045 //: Look if the two segments cross.
00046 //-----------------------------------------------------------------------------
00047   static bool cross_seg(double f1x,double f1y,double f2x,double f2y,//first segment
00048             double s1x,double s1y,double s2x,double s2y);//second segment
00049 
00050 //-----------------------------------------------------------------------------
00051 //: Compute the crossing point "inter" of a segment and a line.
00052 // alpha is the angle between the two.
00053 // It returns true iff the line crosses the segment inside [start_seg,end_seg].
00054 //-----------------------------------------------------------------------------
00055   static bool line_cross_seg(vnl_double_3 start_seg, vnl_double_3 end_seg,
00056                              vnl_double_3 & line_equ, vnl_double_3 & inter,
00057                              double &alpha);
00058 };
00059 
00060 #endif //vmal_operators_h_