Moka kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
geometry.hh
Go to the documentation of this file.
1 /*
2  * lib-gmapkernel : Un noyau de 3-G-cartes et des opérations.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-gmapkernel
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #ifndef GEOMETRY_HH
26 #define GEOMETRY_HH
27 //******************************************************************************
28 #include "inline-macro.hh"
29 #include "math-extension.hh"
30 #include "vertex.hh"
31 //******************************************************************************
32 
47 class CGeometry
48 {
49 public:
50  // @name Projections
51  // @{
52 
64  static CVertex orthoProjectVertexOnLine(const CVertex& AVertex,
65  const CVertex& ALineVertex,
66  const CVertex& ALineDirection);
67 
76  static CVertex
77  orthoProjectVertexOnPlane(const CVertex& AVertex,
78  const TCoordinate& AA, const TCoordinate& AB,
79  const TCoordinate& AC, const TCoordinate& AD);
80 
92  static CVertex orthoProjectVertexOnPlane(const CVertex& AVertex,
93  const CVertex& APlaneVertex,
94  const CVertex& APlaneNormal);
95 
96  // @}
97  // @name Homothéties
98  // @{
99 
109  static CVertex centralHomothety(const CVertex& AVertex,
110  const CVertex& ACenter,
111  const TCoordinate& ACoef);
112 
122  static CVertex centralHomothety(const CVertex& AVertex,
123  const CVertex& ACenter,
124  const CVertex& ACoef);
125 
139  static CVertex axialHomothety(const CVertex& AVertex,
140  const CVertex& ALineVertex,
141  const CVertex& ALineDirection,
142  const TCoordinate& ACoef);
143 
157  static CVertex planarHomothety(const CVertex& AVertex,
158  const CVertex& APlaneVertex,
159  const CVertex& APlaneNormal,
160  const TCoordinate& ACoef);
161 
162  // @}
163  // @name Calcul de la distance d'un sommet à un autre objet
164  // @{
165 
173  static TCoordinate distanceToVertex(const CVertex& AVertex,
174  const CVertex& AOtherVertex);
175 
188  static TCoordinate distanceToLine(const CVertex& AVertex,
189  const CVertex& ALineVertex,
190  const CVertex& ALineDirection);
191 
204  static TCoordinate distanceToPlane(const CVertex& AVertex,
205  const CVertex& APlaneVertex,
206  const CVertex& APlaneNormal);
207 
208  // @}
209  // @name Fonctions géométriques diverses
210  // @{
211 
223  static CVertex getBissectrix(const CVertex& AVector1,
224  const CVertex& AVector2,
225  const CVertex& ANormal = ORIGIN);
226 
234  static CVertex getNormalVector(const CVertex& AVector);
235 
249  static CVertex getNormalVector(const CVertex& AVector1,
250  const CVertex& AVector2);
251 
256  static CVertex getNormalVector(const CVertex& AVertex1,
257  const CVertex& AVertex2,
258  const CVertex& AVertex3);
259 
274  static CVertex getLinesIntersection(const CVertex& ALine1Vertex1,
275  const CVertex& ALine1Vertex2,
276  const CVertex& ALine2Vertex1,
277  const CVertex& ALine2Vertex2);
278 
286  static bool areColinear(const CVertex& AVertex1, const CVertex& AVertex2);
287 
299  static TCoordinate getAngle(const CVertex& AVector1,
300  const CVertex& AVector2,
301  const CVertex& ANormal = ORIGIN);
302 
317  static CVertex getAngles(const CVertex& AVx, const CVertex& AVz);
318 
319  // @}
320  // @name Méthodes auxiliaires pour le coraffinement 2D
321  // @{
322 
343  static int localiseVertexComparedToLine(const CVertex& AVertex,
344  const CVertex& ALineVertex,
345  const CVertex& ALineDirection,
346  const CVertex& APlaneNormal);
347 
384  static void getSegmentsIntersection(const CVertex& AVertexA,
385  const CVertex& AVertexB,
386  const CVertex& AVertexC,
387  const CVertex& AVertexD,
388  const CVertex& APlaneNormal,
389  int& AIntersection1On,
390  CVertex& AIntersection1,
391  int& AIntersection2On,
392  CVertex& AIntersection2);
393 
398  static void getSegmentsIntersection2d(const CVertex& AVertexA,
399  const CVertex& AVertexB,
400  const CVertex& AVertexC,
401  const CVertex& AVertexD,
402  int& AIntersection1On,
403  CVertex& AIntersection1,
404  int& AIntersection2On,
405  CVertex& AIntersection2);
406 
407  // @}
408  // @name Méthodes pour le chanfreinage :
409  // @{
410 
416  static CVertex getRoundingNormalVector(const CVertex& AVertex1,
417  const CVertex& AVertex2,
418  const CVertex& AVertex3);
419 
420  // @}
421 };
422 //******************************************************************************
423 #include INCLUDE_INLINE("geometry.icc")
424 //******************************************************************************
425 #endif // GEOMETRY_HH
426 //******************************************************************************