PrimitivePositioning.h
Go to the documentation of this file.
00001 /*
00002  This file is part of the VRender library.
00003  Copyright (C) 2005 Cyril Soler (Cyril.Soler@imag.fr)
00004  Version 1.0.0, released on June 27, 2005.
00005 
00006  http://artis.imag.fr/Members/Cyril.Soler/VRender
00007 
00008  VRender is free software; you can redistribute it and/or modify
00009  it under the terms of the GNU General Public License as published by
00010  the Free Software Foundation; either version 2 of the License, or
00011  (at your option) any later version.
00012 
00013  VRender is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  GNU General Public License for more details.
00017 
00018  You should have received a copy of the GNU General Public License
00019  along with VRender; if not, write to the Free Software Foundation, Inc.,
00020  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00021 */
00022 
00023 /****************************************************************************
00024 
00025  Copyright (C) 2002-2013 Gilles Debunne. All rights reserved.
00026 
00027  This file is part of the QGLViewer library version 2.4.0.
00028 
00029  http://www.libqglviewer.com - contact@libqglviewer.com
00030 
00031  This file may be used under the terms of the GNU General Public License 
00032  versions 2.0 or 3.0 as published by the Free Software Foundation and
00033  appearing in the LICENSE file included in the packaging of this file.
00034  In addition, as a special exception, Gilles Debunne gives you certain 
00035  additional rights, described in the file GPL_EXCEPTION in this package.
00036 
00037  libQGLViewer uses dual licensing. Commercial/proprietary software must
00038  purchase a libQGLViewer Commercial License.
00039 
00040  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00041  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00042 
00043 *****************************************************************************/
00044 
00045 #ifndef _PRIMITIVEPOSITIONING_H
00046 #define _PRIMITIVEPOSITIONING_H
00047 
00048 #include <vector>
00049 #include "gpc.h"
00050 
00051 namespace vrender
00052 {
00053         class Primitive ;
00054 
00055         // This class implements a static method for positioning two primitives relative to each other.
00056 
00057         class PrimitivePositioning
00058         {
00059                 public:
00060                         typedef enum { Independent = 0x0,
00061                                                                 Upper           = 0x1,
00062                                                                 Lower           = 0x2 } RelativePosition ;
00063 
00064                         static int computeRelativePosition(const Primitive *p1,const Primitive *p2) ;
00065 
00066                         static void splitPrimitive(Primitive *P,const NVector3& v,double c,Primitive *& prim_up,Primitive *& prim_lo) ;
00067 
00068                         static void split(Segment *S,   const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00069                         static void split(Point *P,     const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00070                         static void split(Polygone *P,const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00071 
00072                 private:
00073                         static void getsigns(const Primitive *P,const NVector3& v,
00074                                                                                 double C,std::vector<int>& signs,std::vector<double>& zvals,
00075                                                                                 int& Smin,int& Smax,double I_EPS) ;
00076 
00077                         static int computeRelativePosition(const Polygone  *p1,const Polygone  *p2) ;
00078                         static int computeRelativePosition(const Polygone  *p1,const Segment   *p2) ;
00079                         static int computeRelativePosition(const Polygone  *p1,const Point     *p2) ;
00080                         static int computeRelativePosition(const Segment   *p1,const Segment   *p2) ;
00081 
00082                         //  2D intersection/positioning methods. Parameter I_EPS may be positive of negative
00083                         // depending on the wanted degree of conservativeness of the result.
00084 
00085                         static bool pointOutOfPolygon_XY(const Vector3&  P,const Polygone *Q,double I_EPS) ;
00086                         static bool intersectSegments_XY(const Vector2& P1,const Vector2& Q1,
00087                                                                                                                 const Vector2& P2,const Vector2& Q2,
00088                                                                                                                 double I_EPS,double & t1,double & t2) ;
00089                         static gpc_polygon createGPCPolygon_XY(const Polygone *P) ;
00090 
00091 
00092                         static int inverseRP(int) ;
00093 
00094                         //  This value is *non negative*. It may be used with a negative sign
00095                         // in 2D methods such as pointOutOfPolygon() so as to rule the behaviour of
00096                         // the positionning.
00097 
00098                         static double _EPS ;
00099         };
00100 }
00101 
00102 #endif


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Feb 11 2016 23:51:20