Class representing a Triangle.
More...
#include <Triangle.h>
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 () |
void | applyForce (const Vec3 &f) |
void | zeroForce () |
pair< int, Vec3 > | getP0 () const |
pair< int, Vec3 > | getP1 () const |
pair< int, Vec3 > | getP2 () const |
Vec3 | getForce () const |
double | getPressure () const |
Detailed Description
Class representing a Triangle.
- Author
- Steffen Abe $Revision$ $$Date$
Constructor & Destructor Documentation
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
-
id0 | id of the first corner |
id1 | id of the 2nd corner |
id2 | id of the 3rd corner |
v0 | first corner |
v1 | second corner |
v2 | third corner |
tri_id | triangle id |
tag | triangle tag |
References Matrix3::inv().
Member Function Documentation
bool Triangle::containsEdge |
( |
const Vec3 & |
p1, |
|
|
const Vec3 & |
p2 |
|
) |
| const |
check if an edge given by 2 points is in the triangle
- Parameters
-
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
-
Referenced by ETriangleInteraction::calcForces(), and Edge::isValidContact().
Vec3 Triangle::getBoundingBoxMax |
( |
| ) |
const |
Get max. corner of axis-aligned bounding box of the triangle.
Vec3 Triangle::getBoundingBoxMin |
( |
| ) |
const |
Get min. corner of axis-aligned bounding box of the triangle.
double Triangle::getPressure |
( |
| ) |
const |
Triangle::ScalarFieldFunction Triangle::getScalarFieldFunction |
( |
const string & |
name | ) |
|
|
static |
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
-
name | the name of the field |
Referenced by TSubLattice< T >::addVectorTriangleField().
void Triangle::move |
( |
const Vec3 & |
d | ) |
|
Move (translate) whole triangle.
- Parameters
-
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
-
id | the global id of the node to be moved |
d | the amount of movement |
References Matrix3::inv().
double Triangle::sep |
( |
const Vec3 & |
p | ) |
const |
Get distance between point and the triangle.
- Parameters
-
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
-
p | the point to be transformed |
Referenced by BTriangleInteraction::calcForces().
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
-
p | the point to be transformed |
Referenced by BTriangleInteraction::BTriangleInteraction().
Friends And Related Function Documentation
ostream& operator<< |
( |
ostream & |
ost, |
|
|
const Triangle & |
T |
|
) |
| |
|
friend |
output for debugging purposes
output Triangle to ostream
The documentation for this class was generated from the following files: