Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

_QGAR_point.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------+
00002  | Library QgarLib, graphics analysis and recognition                  |
00003  | Copyright (C) 2002  Qgar Project, LORIA                             |
00004  |                                                                     |
00005  | This library is free software; you can redistribute it and/or       |
00006  | modify it under the terms of the GNU Lesser General Public          |
00007  | License version 2.1, as published by the Free Software Foundation.  |
00008  |                                                                     |
00009  | This library is distributed in the hope that it will be useful,     |
00010  | but WITHOUT ANY WARRANTY; without even the implied warranty of      |
00011  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                |
00012  | See the GNU Lesser General Public License for more details.         |
00013  |                                                                     |
00014  | The GNU Lesser General Public License is included in the file       |
00015  | LICENSE.LGPL, in the root directory of the Qgar packaging. See      |
00016  | http://www.gnu.org/licenses/lgpl.html for the terms of the licence. |
00017  | To receive a paper copy, write to the Free Software Foundation,     |
00018  | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.       |
00019  |                                                                     |
00020  | Contact Project Qgar for any information:                           |
00021  |   LORIA - équipe Qgar                                               |
00022  |   B.P. 239, 54506 Vandoeuvre-lès-Nancy Cedex, France                |
00023  |   email: qgar-contact@loria.fr                                      |
00024  |   http://www.qgar.org/                                              |
00025  *---------------------------------------------------------------------*/
00026 
00027 
00028 #ifndef ___QGAR_POINT_H_INCLUDED__
00029 #define ___QGAR_POINT_H_INCLUDED__
00030 
00031 
00032 /**
00033  * @file   _QGAR_point.H
00034  * @brief  Global geometrical functions which compute points.
00035  *
00036  * @warning <b>Not to be used as include file!</b>
00037  * <br>When working with primitives, use header file primitives.H.
00038  *
00039  * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Gérald Masini">Gérald Masini</a>
00040  * @date   February 03 2005,  18:44
00041  * @since  Qgar 2.2
00042  */
00043 
00044 
00045 // For RCS/CVS use: Do not delete
00046 /* $Id: _QGAR_point.H,v 1.3 2005/10/14 17:05:48 masini Exp $ */
00047 
00048 
00049 
00050 
00051 // QGAR
00052 #include <qgarlib/math.H>
00053 
00054 
00055 
00056 namespace qgar
00057 {
00058 
00059 
00060 /**
00061  * @name Global geometrical functions which compute points
00062  */
00063 //@{
00064 
00065 
00066 // -------------------------------------------------------------------
00067 // A R C S   A N D   C I R C L E S
00068 // -------------------------------------------------------------------
00069 
00070 
00071 /**
00072  * @ingroup GLOB_PRIM_PT
00073  *
00074  * @brief Center of the circle passing through three given points.
00075  *
00076  * Return <b>false</b> if the 3 points are collinear,
00077  * <b>true</b> otherwise.
00078  *
00079  * @param t        a point
00080  * @param p        a point
00081  * @param q        a point
00082  * @param aCenter  center of the circle
00083  *
00084  * @warning The center has <b>double</b> coordinates.
00085  */
00086 template <class T>
00087 bool
00088 qgCircleCenter(const GenPoint<T>& t,
00089                const GenPoint<T>& p,
00090                const GenPoint<T>& q,
00091                GenPoint<double>&  aCenter);
00092 
00093 
00094 // -------------------------------------------------------------------
00095 // I N T E R S E C T I O N S
00096 // -------------------------------------------------------------------
00097 
00098 
00099 /**
00100  * @ingroup GLOB_PRIM_PT
00101  *
00102  * @brief Intersection of the lines supporting two given segments.
00103  *
00104  * Return <b>false</b> if the lines supporting the segments are
00105  * approximately collinear/parallel according to threshold <b>anAngle</b>.
00106  * Otherwise, assign the intersection point to <b>i</b> and return
00107  * <b>true</b>.
00108  *
00109  * @param ab  a segment (AB)
00110  * @param cd  a segment (CD)
00111  * @param i   resulting intersection point (I)
00112  * @param anAngle  threshold angle to decide whether current and given
00113  *   segments are collinear or parallel (default qgar::Math::epsilonRadian())
00114  *
00115  * @warning The intersection point has <b>double</b> coordinates.
00116  */
00117 template <class T>
00118 bool
00119 qgIntersect(const GenSegment<T>& ab,
00120             const GenSegment<T>& cd,
00121             GenPoint<double>& i,
00122             double anAngle = Math::epsilonRadian());
00123 
00124 
00125 /**
00126  * @ingroup GLOB_PRIM_PT
00127  *
00128  * @brief Intersection of the lines supporting two given Qgar segments.
00129  *
00130  * Return <b>false</b> if the lines supporting the segments are
00131  * approximately collinear/parallel according to threshold <b>anAngle</b>.
00132  * Otherwise, assign the intersection point to <b>i</b> and return
00133  * <b>true</b>.
00134  *
00135  * @param aQSeg1   a Qgar segment
00136  * @param aQSeg2   a Qgar segment
00137  * @param aPt      resulting intersection point
00138  * @param anAngle  threshold angle to decide whether current and given
00139  *   segments are collinear or parallel (default qgar::Math::epsilonRadian())
00140  *
00141  * @warning The intersection point has <b>double</b> coordinates.
00142  */
00143 template <class T>
00144 inline bool
00145 qgIntersect(const GenQgarSegment<T>& aQSeg1,
00146             const GenQgarSegment<T>& aQSeg2,
00147             GenPoint<double>& aPt,
00148             double anAngle = Math::epsilonRadian());
00149 
00150 
00151 // -------------------------------------------------------------------
00152 // M I D D L E   P O I N T S
00153 // -------------------------------------------------------------------
00154 
00155 
00156 /**
00157  * @ingroup GLOB_PRIM_PT
00158  *
00159  * @brief Return the middle point of a segment.
00160  *
00161  * @param aSeg  a segment
00162  *
00163  * @warning The resulting point has <b>double</b> coordinates.
00164  */
00165 template <class T>
00166 inline GenPoint<double>
00167 qgMiddle(const GenSegment<T>& aSeg);
00168 
00169 
00170 /**
00171  * @ingroup GLOB_PRIM_PT
00172  *
00173  * @brief Return the middle point of a Qgar segment.
00174  *
00175  * @param aQSeg  a Qgar segment
00176  *
00177  * @warning The resulting point has <b>double</b> coordinates.
00178  */
00179 template <class T>
00180 inline GenPoint<double>
00181 qgMiddle(const GenQgarSegment<T>& aQSeg);
00182 
00183 
00184 /**
00185  * @ingroup GLOB_PRIM_PT
00186  *
00187  * @brief Return the middle point of the segment joining two points.
00188  *
00189  * @param aPt1  a point
00190  * @param aPt2  a point
00191  *
00192  * @warning The resulting point has <b>double</b> coordinates.
00193  */
00194 template <class T>
00195 inline GenPoint<double>
00196 qgMiddle(const GenPoint<T>& aPt1, const GenPoint<T>& aPt2);
00197 
00198 
00199 // -------------------------------------------------------------------
00200 // P R O J E C T I O N S
00201 // -------------------------------------------------------------------
00202 
00203 
00204 /**
00205  * @ingroup GLOB_PRIM_PT
00206  *
00207  * @brief Return the orthogonal projection of a point onto a segment.
00208  *
00209  * @param aPt   a point
00210  * @param aSeg  a segment
00211  *
00212  * @warning The resulting point has <b>double</b> coordinates.
00213  * @since Qgar 2.2
00214  */
00215 template <class T>
00216 GenPoint<double>
00217 qgProjectPoint(const GenPoint<T>& aPt, const GenSegment<T>& aSeg);
00218 
00219 
00220 /**
00221  * @ingroup GLOB_PRIM_PT
00222  *
00223  * @brief Orthogonal projection of a point onto a segment.
00224  *
00225  * @param aPt   a point
00226  * @param aSeg  a segment
00227  *
00228  * @warning The point has <b>double</b> coordinates.
00229  * @since Qgar 2.2
00230  */
00231 template <class T>
00232 inline void
00233 qgProject(GenPoint<double>& aPt, const GenSegment<T>& aSeg);
00234 
00235 
00236 /**
00237  * @ingroup GLOB_PRIM_PT
00238  *
00239  * @brief Return the orthogonal projection of a point
00240  *   onto a Qgar segment.
00241  *
00242  * @param aPt    a point
00243  * @param aQSeg  a Qgar segment
00244  *
00245  * @warning The resulting point has <b>double</b> coordinates.
00246  * @since Qgar 2.2
00247  */
00248 template <class T>
00249 inline GenPoint<double>
00250 qgProjectPoint(const GenPoint<T>& aPt, const GenQgarSegment<T>& aQSeg);
00251 
00252 
00253 /**
00254  * @brief Ortogonal projection of a point onto a Qgar segment.
00255  *
00256  * @param aPt    a point
00257  * @param aQSeg  a Qgar segment
00258  *
00259  * @warning The point has <b>double</b> coordinates.
00260  * @since Qgar 2.2
00261  */
00262 template <class T>
00263 inline void
00264 qgProject(GenPoint<double>& aPt, const GenQgarSegment<T>& aQSeg);
00265 
00266 
00267 // -------------------------------------------------------------------
00268 
00269 
00270 //@}
00271 
00272 
00273 } // namespace qgar
00274 
00275 
00276 #endif /* ___QGAR_POINT_H_INCLUDED__ */