ESyS-Particle
4.0.1
|
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 __CORNER_H 00014 #define __CORNER_H 00015 00016 //-- Project includes -- 00017 #include "Foundation/vec3.h" 00018 #include "Geometry/Triangle.h" 00019 #include "Geometry/Edge.h" 00020 00021 //-- STL includes -- 00022 #include <vector> 00023 00024 using std::vector; 00025 00034 class Corner 00035 { 00036 private: 00037 Vec3 m_p; 00038 Vec3 m_old_pos; 00039 vector<Edge*> m_edges; 00040 vector<Triangle*> m_triangles; 00041 int m_id; 00042 int m_tag; 00043 00044 public: 00045 Corner(const Vec3&,int,int); 00046 00047 void addEdge(Edge*); 00048 void addTriangle(Triangle*); 00049 double sep(const Vec3&) const; 00050 // pair<bool,double> dist(const Vec3&) const ; // signed separation according to direction of the normal 00051 bool isValidContact(const Vec3&) const; 00052 Vec3 getDirectionFromPoint(const Vec3&) const; 00053 void move(const Vec3&); 00054 Vec3 getPos()const {return m_p;}; 00055 void setPos(const Vec3 &p) {m_p = p;} 00056 void applyForce(const Vec3 &f); 00057 int getID() const {return m_id;}; 00058 int getTag() const {return m_tag;}; 00059 00060 double getDistMoved() {return (m_old_pos-m_p).norm();}; 00061 void resetOldPos(){m_old_pos=m_p;}; 00062 }; 00063 00064 #endif // __CORNER_H