glc_distance.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Copyright (C) 2009 Pierre Soetewey
00006  Version 2.0.0 Beta 1, packaged on April 2010.
00007 
00008  http://glc-lib.sourceforge.net
00009 
00010  GLC-lib is free software; you can redistribute it and/or modify
00011  it under the terms of the GNU General Public License as published by
00012  the Free Software Foundation; either version 2 of the License, or
00013  (at your option) any later version.
00014 
00015  GLC-lib is distributed in the hope that it will be useful,
00016  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  GNU General Public License for more details.
00019 
00020  You should have received a copy of the GNU General Public License
00021  along with GLC-lib; if not, write to the Free Software
00022  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023 
00024  *****************************************************************************/
00025 
00026 #ifndef GLC_DISTANCE_H_
00027 #define GLC_DISTANCE_H_
00028 
00029 #include <QList>
00030 #include "../glc_object.h"
00031 #include "../sceneGraph/glc_3dviewinstance.h"
00032 
00033 #include "../glc_config.h"
00034 
00035 class GLC_Mesh;
00036 class PQP_Model;
00037 
00040 
00044 
00045 class GLC_LIB_EXPORT GLC_Distance : public GLC_Object
00046 {
00047         struct DistanceResult
00048         {
00049                 double m_Distance;
00050                 GLC_Point3d m_Point1;
00051                 GLC_Point3d m_Point2;
00052                 GLC_uint m_InstanceId1;
00053                 GLC_uint m_InstanceId2;
00054         };
00056 
00058 
00059 public:
00061         GLC_Distance();
00062 
00064         GLC_Distance(const GLC_3DViewInstance&, const GLC_3DViewInstance&);
00065 
00067         GLC_Distance(const GLC_Distance&);
00068 
00070         virtual ~GLC_Distance();
00072 
00074 
00076 
00077 public:
00079         void clear();
00080 
00082         void addInstanceInGroup1(const GLC_3DViewInstance&);
00083 
00085         void addInstancesInGroup1(const QList<GLC_3DViewInstance>&);
00086 
00088         void addInstanceInGroup2(const GLC_3DViewInstance&);
00089 
00091         void addInstancesInGroup2(const QList<GLC_3DViewInstance>&);
00092 
00094         void computeMinimumDistance();
00095 
00097         inline void setRelativeError(double error)
00098         {m_RelativeError= error;}
00099 
00101         inline void setAbsoluteError(double error)
00102         {m_RelativeError= error;}
00103 
00105 
00106 
00108 
00109 public:
00111         inline double distMin() const
00112         {return m_DistanceMini;}
00113 
00115         inline GLC_Point3d point1() const
00116         {return m_Point1;}
00117 
00119         inline GLC_Point3d point2() const
00120         {return m_Point2;}
00121 
00123         inline double relativeError() const
00124         {return m_RelativeError;}
00125 
00127         inline double absoluteError() const
00128         {return m_AbsoluteError;}
00129 
00131 
00133 
00135 
00136 private:
00137 
00139         DistanceResult minimumDistance(QList<GLC_3DViewInstance>&, QList<GLC_3DViewInstance>&) const;
00140 
00142         void getPQPPoint(double&, double&, double&, const double, const double, const double, const GLC_Matrix4x4&) const;
00143 
00145         void addMeshTrianglesToPQP(PQP_Model*, const QList<GLC_Mesh*>, const GLC_Matrix4x4&) const;
00146 
00148 
00150 // Private members
00152 private:
00154         QList<GLC_3DViewInstance> m_ListOfInstances1;
00155 
00157         QList<GLC_3DViewInstance> m_ListOfInstances2;
00158 
00160         GLC_Point3d m_Point1;
00161 
00163         GLC_Point3d m_Point2;
00164 
00166         double m_DistanceMini;
00167 
00169         double m_RelativeError;
00170 
00172         double m_AbsoluteError;
00173 };
00174 
00175 #endif /* GLC_DISTANCE_H_ */

SourceForge.net Logo

©2005 Laurent Ribon