ESyS-Particle  2.3.4
Triangle Class Reference

Class representing a Triangle. More...

#include <Triangle.h>

Collaboration diagram for Triangle:

Public Types

typedef Vec3(Triangle::* VectorFieldFunction) () const
 
typedef double(Triangle::* ScalarFieldFunction) () const
 

Public Member Functions

 Triangle (int, int, int, const Vec3 &, const Vec3 &, const Vec3 &, int, int)
 
double sep (const Vec3 &) const
 
pair< bool, double > dist (const Vec3 &) const
 
Vec3 getBoundingBoxMin () const
 
Vec3 getBoundingBoxMax () const
 
Vec3 getNormal () const
 
Vec3 toGlobal (const Vec3 &)
 
Vec3 toLocal (const Vec3 &)
 
bool containsEdge (const Vec3 &, const Vec3 &) const
 
void moveNode (int, const Vec3 &)
 
void move (const Vec3 &)
 
int getID () const
 
int getTag () const
 
void applyForce (const Vec3 &f)
 
void zeroForce ()
 
pair< int, Vec3getP0 () const
 
pair< int, Vec3getP1 () const
 
pair< int, Vec3getP2 () const
 
Vec3 getForce () const
 
double getPressure () const
 

Static Public Member Functions

static VectorFieldFunction getVectorFieldFunction (const string &)
 
static ScalarFieldFunction getScalarFieldFunction (const string &)
 

Private Member Functions

double EdgeSep (const Vec3 &, const Vec3 &, const Vec3 &) const
 

Private Attributes

Matrix3 m_invtrans
 
Matrix3 m_trans
 
Vec3 m_p0
 
Vec3 m_p1
 
Vec3 m_p2
 
Vec3 m_normal
 
Vec3 m_force
 
int m_id0
 
int m_id1
 
int m_id2
 
int m_tri_id
 
int m_tag
 

Friends

ostream & operator<< (ostream &, const Triangle &)
 output for debugging purposes More...
 

Detailed Description

Class representing a Triangle.

Author
Steffen Abe $Revision$ $$Date$

Member Typedef Documentation

◆ ScalarFieldFunction

typedef double(Triangle::* Triangle::ScalarFieldFunction) () const

◆ VectorFieldFunction

typedef Vec3(Triangle::* Triangle::VectorFieldFunction) () const

Constructor & Destructor Documentation

◆ Triangle()

Triangle::Triangle ( int  id0,
int  id1,
int  id2,
const Vec3 v0,
const Vec3 v1,
const Vec3 v2,
int  tri_id,
int  tag 
)

Construct triangle from the corner coordinates. It is assumed that the corners are given anticlockwise and the normal is calculated accordingly.

Parameters
id0id of the first corner
id1id of the 2nd corner
id2id of the 3rd corner
v0first corner
v1second corner
v2third corner
tri_idtriangle id
tagtriangle tag

References cross(), Matrix3::inv(), m_force, m_id0, m_id1, m_id2, m_invtrans, m_normal, m_p0, m_p1, m_p2, m_tag, m_trans, m_tri_id, and Vec3::unit_s().

Here is the call graph for this function:

Member Function Documentation

◆ applyForce()

void Triangle::applyForce ( const Vec3 f)
inline

References m_force.

Referenced by Edge::applyForce(), BTriangleInteraction::calcForces(), and ETriangleInteraction::calcForces().

Here is the caller graph for this function:

◆ containsEdge()

bool Triangle::containsEdge ( const Vec3 p1,
const Vec3 p2 
) const

check if an edge given by 2 points is in the triangle

Parameters
p1
p2

References m_p0, m_p1, and m_p2.

◆ dist()

pair< bool, double > Triangle::dist ( const Vec3 p) const

Get the signed distance between a point and the triangle. If the closest point on the supporting plane is outside the triangle, the first component of the return value is "false", otherwise "true"

Parameters
pthe point

References m_invtrans, m_normal, m_p0, Vec3::X(), and Vec3::Y().

Referenced by ETriangleInteraction::calcForces(), and Edge::isValidContact().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EdgeSep()

double Triangle::EdgeSep ( const Vec3 p0,
const Vec3 p1,
const Vec3 p 
) const
private

calculate distance between an edge and a point

Parameters
p0point 1 of the edge
p1point 2 of the edge
pthe point

References Vec3::norm(), sep(), and Vec3::unit().

Referenced by sep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBoundingBoxMax()

Vec3 Triangle::getBoundingBoxMax ( ) const

Get max. corner of axis-aligned bounding box of the triangle.

References cmax(), m_p0, m_p1, and m_p2.

Referenced by NeighborTable< T >::getParticlesNearTriangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBoundingBoxMin()

Vec3 Triangle::getBoundingBoxMin ( ) const

Get min. corner of axis-aligned bounding box of the triangle.

References cmin(), m_p0, m_p1, and m_p2.

Referenced by NeighborTable< T >::getParticlesNearTriangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getForce()

Vec3 Triangle::getForce ( ) const
inline

References m_force.

Referenced by TSubLattice< T >::getTriMeshForce(), and getVectorFieldFunction().

Here is the caller graph for this function:

◆ getID()

int Triangle::getID ( ) const
inline

References m_tri_id.

Referenced by BTriangleInteraction::BTriangleInteraction().

Here is the caller graph for this function:

◆ getNormal()

Vec3 Triangle::getNormal ( ) const
inline

References m_normal.

Referenced by ETriangleInteraction::calcForces().

Here is the caller graph for this function:

◆ getP0()

pair<int,Vec3> Triangle::getP0 ( ) const
inline

References m_id0, and m_p0.

◆ getP1()

pair<int,Vec3> Triangle::getP1 ( ) const
inline

References m_id1, m_p0, and m_p1.

◆ getP2()

pair<int,Vec3> Triangle::getP2 ( ) const
inline

References m_id2, m_p0, and m_p2.

◆ getPressure()

double Triangle::getPressure ( ) const

Get pressure on the triangle from interaction forces

References m_force, m_normal, m_p1, and m_p2.

Referenced by getScalarFieldFunction().

Here is the caller graph for this function:

◆ getScalarFieldFunction()

Triangle::ScalarFieldFunction Triangle::getScalarFieldFunction ( const string &  name)
static

Get the triangle member function which returns a scalar field of a given name. Returns NULL if a field with that name doesn't exist.

Parameters
namethe name of the field

References getPressure(), and NULL.

Referenced by TSubLattice< T >::addScalarTriangleField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTag()

int Triangle::getTag ( ) const
inline

References m_tag.

◆ getVectorFieldFunction()

Triangle::VectorFieldFunction Triangle::getVectorFieldFunction ( const string &  name)
static

Get the triangle member function which returns a vector field of a given name. Returns NULL if a field with that name doesn't exist.

Parameters
namethe name of the field

References getForce(), and NULL.

Referenced by TSubLattice< T >::addVectorTriangleField().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ move()

void Triangle::move ( const Vec3 d)

Move (translate) whole triangle.

Parameters
dthe amount of movement

References m_p0.

◆ moveNode()

void Triangle::moveNode ( int  id,
const Vec3 d 
)

Move one of the corners. The identifier for the corner is the global node id. If the node with the id is not in the triangle, do nothing.

Parameters
idthe global id of the node to be moved
dthe amount of movement

References cross(), Matrix3::inv(), m_id0, m_id1, m_id2, m_invtrans, m_normal, m_p0, m_p1, m_p2, m_trans, and Vec3::unit_s().

Here is the call graph for this function:

◆ sep()

double Triangle::sep ( const Vec3 p) const

Get distance between point and the triangle.

Parameters
pthe point

References EdgeSep(), m_invtrans, m_normal, m_p0, m_p1, m_p2, Vec3::X(), and Vec3::Y().

Referenced by EdgeSep(), and NeighborTable< T >::getParticlesNearTriangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toGlobal()

Vec3 Triangle::toGlobal ( const Vec3 p)

Transform a point in local coordinates into global coordiantes. The local coordinate systems is formed by (P1-P0,P2-P0,N).

Parameters
pthe point to be transformed

References m_p0, and m_trans.

Referenced by BTriangleInteraction::calcForces(), and BTriangleInteraction::getAP().

Here is the caller graph for this function:

◆ toLocal()

Vec3 Triangle::toLocal ( const Vec3 p)

Transform a point in global coordinates into local coordiantes. The local coordinate systems is formed by (P1-P0,P2-P0,N).

Parameters
pthe point to be transformed

References m_invtrans, and m_p0.

Referenced by BTriangleInteraction::BTriangleInteraction().

Here is the caller graph for this function:

◆ zeroForce()

void Triangle::zeroForce ( )
inline

References m_force.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  ost,
const Triangle T 
)
friend

output for debugging purposes

output Triangle to ostream

Member Data Documentation

◆ m_force

Vec3 Triangle::m_force
private

◆ m_id0

int Triangle::m_id0
private

Referenced by getP0(), moveNode(), and Triangle().

◆ m_id1

int Triangle::m_id1
private

Referenced by getP1(), moveNode(), and Triangle().

◆ m_id2

int Triangle::m_id2
private

Referenced by getP2(), moveNode(), and Triangle().

◆ m_invtrans

Matrix3 Triangle::m_invtrans
private

Referenced by dist(), moveNode(), sep(), toLocal(), and Triangle().

◆ m_normal

Vec3 Triangle::m_normal
private

◆ m_p0

◆ m_p1

◆ m_p2

◆ m_tag

int Triangle::m_tag
private

Referenced by getTag(), and Triangle().

◆ m_trans

Matrix3 Triangle::m_trans
private

Referenced by moveNode(), toGlobal(), and Triangle().

◆ m_tri_id

int Triangle::m_tri_id
private

Referenced by getID(), and Triangle().


The documentation for this class was generated from the following files: