00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef JAFAR_FACETSMAPFACETSCLOSENESS_H
00013 #define JAFAR_FACETSMAPFACETSCLOSENESS_H
00014
00015 #include "jmath/jblas.hpp"
00016 #include "facetsmap/facet.hpp"
00017
00018 namespace jafar {
00019
00020 namespace facetsmap {
00021
00025 class FacetsCloseness{
00026 public:
00027 FacetsCloseness(Facet* f1, Facet* f2);
00028 ~FacetsCloseness();
00029 public:
00030
00033 inline double distance() const {
00034 if(m_distanceNeedUpdate)
00035 {
00036 m_distance = ublas::norm_2( m_f1->globalOrigin() - m_f2->globalOrigin() );
00037 m_distanceNeedUpdate = false;
00038 }
00039 return m_distance;
00040 }
00044 inline double parallelism() const
00045 {
00046 if(m_parallelismNeedUpdate)
00047 {
00048 m_parallelism = ublas::inner_prod(m_f1->globalNormal(), m_f2->globalNormal() );
00049 m_parallelismNeedUpdate = false;
00050 }
00051 return m_parallelism;
00052 }
00055 inline double zncc() const {
00056 if(m_znccNeedUpdate)
00057 {
00058 m_zncc = m_f1->compare(m_f2);
00059 m_znccNeedUpdate = false;
00060 }
00061 return m_zncc;
00062 }
00063 public:
00064 Facet * getF1() { return m_f1; };
00065 Facet * getF2() { return m_f2; };
00066 private:
00067 Facet* m_f1;
00068 Facet* m_f2;
00069 mutable double m_distance;
00070 mutable double m_parallelism;
00071 mutable double m_zncc;
00072 mutable bool m_distanceNeedUpdate, m_parallelismNeedUpdate, m_znccNeedUpdate;
00073 };
00074
00075 };
00076
00077 };
00078
00079 #endif