00001
00002
00003 #ifndef _JAFAR_GEOM_COS_ANGLE_COV_VISITOR_HPP_
00004 #define _JAFAR_GEOM_COS_ANGLE_COV_VISITOR_HPP_
00005
00006 #include "AtomVisitor.hpp"
00007 #include "CosAngleCov.hpp"
00008
00009 namespace jafar {
00010 namespace geom {
00011 template<int dimension>
00012 class CosAngleCovVisitor : public AtomVisitor<dimension>
00013 {
00014 public:
00015 CosAngleCovVisitor() : m_cosAngle(0.0), m_cosAngleCov(0.0) {}
00016 double cosAngle() const { return m_cosAngle; }
00017 double cosAngleCov() const { return m_cosAngleCov; }
00018 protected:
00019 double m_cosAngle, m_cosAngleCov;
00020 };
00021 template<class _AtomT_>
00022 class CosAngleCovVisitorImpl : public CosAngleCovVisitor<_AtomT_::Dimension>
00023 {
00024 public:
00025 CosAngleCovVisitorImpl(const _AtomT_* atom) : m_atom(atom)
00026 {
00027 }
00028 virtual void visit( const geom::Point<_AtomT_::Dimension>& point)
00029 {
00030 this->m_cosAngle = 0;
00031 this->m_cosAngleCov = 0;
00032 }
00033 virtual void visit( const geom::Line<_AtomT_::Dimension>& line)
00034 {
00035 cosAngleCov( *m_atom, line, this->m_cosAngle, this->m_cosAngleCov );
00036 }
00037 virtual void visit( const geom::HyperPlane<_AtomT_::Dimension>& plan)
00038 {
00039 cosAngleCov( *m_atom, plan, this->m_cosAngle, this->m_cosAngleCov );
00040 }
00041 virtual void visit( const geom::Segment<_AtomT_::Dimension>& segment)
00042 {
00043 cosAngleCov( *m_atom, segment, this->m_cosAngle, this->m_cosAngleCov );
00044 }
00045 virtual void visit( const geom::Facet<_AtomT_::Dimension>& facet)
00046 {
00047 cosAngleCov( *m_atom, facet, this->m_cosAngle, this->m_cosAngleCov );
00048 }
00049 private:
00050 const _AtomT_* m_atom;
00051 };
00052
00053 }
00054 }
00055
00056 #endif