ESyS-Particle  4.0.1
Corner2D.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __CORNER2D_H
00014 #define __CORNER2D_H
00015 
00016 //-- Project includes --
00017 #include "Foundation/vec3.h"
00018 #include "Geometry/Edge2D.h"
00019 
00020 //-- STL includes --
00021 #include <vector>
00022 
00023 using std::vector;
00024 
00025 
00034 class Corner2D
00035 {
00036  private:
00037   Vec3 m_p;
00038   vector<Edge2D*> m_edges;
00039   int m_id;
00040 
00041  public:
00042   Corner2D(const Vec3&,int);
00043 
00044   void addEdge(Edge2D*);
00045   double sep(const Vec3&) const;
00046   //  pair<bool,double> dist(const Vec3&) const ; // signed separation according to direction of the normal
00047   bool isValidContact(const Vec3&) const;
00048   Vec3 getDirectionFromPoint(const Vec3&) const;
00049   void move(const Vec3&);
00050   Vec3 getPos()const {return m_p;};
00051   int getID() const {return m_id;};
00052   int getNEdges() const {return m_edges.size();};
00053   Vec3 getEdgeNormal(int) const;
00054   void applyForceToEdge(int,const Vec3&);
00055 };
00056 
00057 #endif // __CORNER2D_H