PrimitivePositioning.h
Go to the documentation of this file.
1 /*
2  This file is part of the VRender library.
3  Copyright (C) 2005 Cyril Soler (Cyril.Soler@imag.fr)
4  Version 1.0.0, released on June 27, 2005.
5 
6  http://artis.imag.fr/Members/Cyril.Soler/VRender
7 
8  VRender is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  VRender is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with VRender; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 /****************************************************************************
24 
25  Copyright (C) 2002-2014 Gilles Debunne. All rights reserved.
26 
27  This file is part of the QGLViewer library version 2.6.3.
28 
29  http://www.libqglviewer.com - contact@libqglviewer.com
30 
31  This file may be used under the terms of the GNU General Public License
32  versions 2.0 or 3.0 as published by the Free Software Foundation and
33  appearing in the LICENSE file included in the packaging of this file.
34  In addition, as a special exception, Gilles Debunne gives you certain
35  additional rights, described in the file GPL_EXCEPTION in this package.
36 
37  libQGLViewer uses dual licensing. Commercial/proprietary software must
38  purchase a libQGLViewer Commercial License.
39 
40  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
41  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42 
43 *****************************************************************************/
44 
45 #ifndef _PRIMITIVEPOSITIONING_H
46 #define _PRIMITIVEPOSITIONING_H
47 
48 #include <vector>
49 #include "gpc.h"
50 
51 namespace vrender
52 {
53  class Primitive ;
54 
55  // This class implements a static method for positioning two primitives relative to each other.
56 
58  {
59  public:
60  typedef enum { Independent = 0x0,
61  Upper = 0x1,
63 
64  static int computeRelativePosition(const Primitive *p1,const Primitive *p2) ;
65 
66  static void splitPrimitive(Primitive *P,const NVector3& v,double c,Primitive *& prim_up,Primitive *& prim_lo) ;
67 
68  static void split(Segment *S, const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
69  static void split(Point *P, const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
70  static void split(Polygone *P,const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
71 
72  private:
73  static void getsigns(const Primitive *P,const NVector3& v,
74  double C,std::vector<int>& signs,std::vector<double>& zvals,
75  int& Smin,int& Smax,double I_EPS) ;
76 
77  static int computeRelativePosition(const Polygone *p1,const Polygone *p2) ;
78  static int computeRelativePosition(const Polygone *p1,const Segment *p2) ;
79  static int computeRelativePosition(const Polygone *p1,const Point *p2) ;
80  static int computeRelativePosition(const Segment *p1,const Segment *p2) ;
81 
82  // 2D intersection/positioning methods. Parameter I_EPS may be positive of negative
83  // depending on the wanted degree of conservativeness of the result.
84 
85  static bool pointOutOfPolygon_XY(const Vector3& P,const Polygone *Q,double I_EPS) ;
86  static bool intersectSegments_XY(const Vector2& P1,const Vector2& Q1,
87  const Vector2& P2,const Vector2& Q2,
88  double I_EPS,double & t1,double & t2) ;
89  static gpc_polygon createGPCPolygon_XY(const Polygone *P) ;
90 
91 
92  static int inverseRP(int) ;
93 
94  // This value is *non negative*. It may be used with a negative sign
95  // in 2D methods such as pointOutOfPolygon() so as to rule the behaviour of
96  // the positionning.
97 
98  static double _EPS ;
99  };
100 }
101 
102 #endif
static gpc_polygon createGPCPolygon_XY(const Polygone *P)
static void splitPrimitive(Primitive *P, const NVector3 &v, double c, Primitive *&prim_up, Primitive *&prim_lo)
static int computeRelativePosition(const Primitive *p1, const Primitive *p2)
static void getsigns(const Primitive *P, const NVector3 &v, double C, std::vector< int > &signs, std::vector< double > &zvals, int &Smin, int &Smax, double I_EPS)
static void split(Segment *S, const NVector3 &v, double C, Primitive *&P_plus, Primitive *&P_moins)
static bool pointOutOfPolygon_XY(const Vector3 &P, const Polygone *Q, double I_EPS)
static bool intersectSegments_XY(const Vector2 &P1, const Vector2 &Q1, const Vector2 &P2, const Vector2 &Q2, double I_EPS, double &t1, double &t2)


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Wed Jun 5 2019 19:26:39