glc_distance.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
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