Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Protected Attributes | List of all members
Face Class Reference

Detailed Description

Triangular face.

A Face always belongs to a Triangulation (which can be retrieved from any Face object by Face::surface()), to which it stores a pointer. When copying collections of Faces, remember that their parent triangulation must exist, otherwise, calls to some member functions of Face will lead to assertion failures.

Face provides access to the indices of its vertices by Face::vertex(), which you might call with integers of using the VertexId enum.

  uint vr, vg, vb;
  Face f;
  vr = f.vertex(1);
  vr = f.vertex(v_red);    // equivalent
  vg = f.vertex(2);
  vg = f.vertex(v_green);  // equivalent

For each set of three vertices, only two different vertex orderings (red,green,blue) are possible, allowing two different normal directions. This restriction is necessary to define a unique face ordering. Thus, if you define a Face(&tg, 45, 61, 2), it is exactly the same as Face(&tg, 2, 45, 61). (Actually, the second variant is stored in both cases.) Normal direction is never changed by this reordering.

Face has moderate size, normally 16 bytes.

#include <edgeface.h>

Collaboration diagram for Face:

Public Member Functions

 Face ()
 empty construction
 Face (const Triangulation *parent, uint p1, uint p2, uint p3)
 definition by vertices
 Face (const Triangulation *parent, const Edge &ed1, const Edge &ed2, const Edge &ed3)
 definition by edges
virtual ~Face ()
 virtual destruction
bool valid () const
 check validity
bool operator== (const Face &a) const
bool operator!= (const Face &a) const
bool operator< (const Face &a) const
uint vertex (uint i) const
void getVertices (uint vi[3]) const
 copy vertex indices into array
const uint * vertices () const
 access vertex index pointer
uint * vertices ()
 access vertex index pointer
void getEdges (Edge edg[3]) const
 copies edges into array
Edge edge (uint i) const
 access edge
bool hasEdge (const Edge &e) const
 check if edge is present in this face
uint opposed (const Edge &e) const
 find vertex opposed to edge e
Edge opposed (uint i) const
 find edge opposed to vertex i
uint neighbors (Face f[3]) const
 find the neighbor faces connected to edges
const Triangulationsurface () const
void setSurface (const Triangulation *parent)
 change reference
Vct3 eval (Real xi, Real eta) const
 evaluate parameters
Real eval (const Vector &u, Real xi, Real eta) const
 evaluate scalar field over triangle
Vct3 normal () const
 compute normal
Vct3 center () const
 compute center
Vct3 project (const Vct3 &pt) const
 project, return parameters and signed distance to projection
Vct3 pierce (const Edge &e) const
 Find the point where an edge would pierce this face, return the projection parameter (u,v,t). More...
SMatrix< 3, 3 > trafo () const
 return transformation matrix for local coordinate system
void gradient (Mtx33 &gm) const
 Gradient. More...
Vct3 gradient (const Vector &x) const
 computes the gradient of global x on this triangle
CpxVct3 gradient (const CpxVector &x) const
 computes the gradient of global x on this triangle
Real corner (uint gv) const
 compute corner angle for (global) vertex gv
Real solidAngle (uint idx) const
 compute solid angle associated with vertex idx
Real solidAngle (uint idx, const Vct3 &a) const
 compute solid angle associated with vertex idx, for normal a
Real quality () const
 triangle quality
void orderCanonical ()
 make ordering canonical
void reverse ()
 reverse normal
void replace (uint vold, uint vnew)
 replace index
uint inside (const BndBox &bb) const
 return how many of this face's vertices are inside the box
Real minDistance (const Vct3 &pt, Vct2 &foot) const
 return minimum signed distance of pt to this triangle, set foot point parameter

Protected Attributes

const Triangulationsrf
 parent object
uint v [3]
 vertex indices

Member Function Documentation

void Face::gradient ( Mtx33 gm) const


Computes the matrix relating a scalar property associated to the vertices to its gradient in global 3D coordinates.

Vct3 Face::pierce ( const Edge e) const

Find the point where an edge would pierce this face, return the projection parameter (u,v,t).

The point is inside the face if 0<u,v,w<1 where w = 1-u-v. (t) is the edge parameter.

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