24 class gsFace :
public gsMeshElement<T>
28 typedef memory::shared_ptr< gsFace > Ptr;
31 typedef memory::unique_ptr< gsFace > uPtr;
33 typedef gsMeshElement<T> MeshElement;
34 typedef typename MeshElement::scalar_t scalar_t;
35 typedef typename MeshElement::gsVertexHandle gsVertexHandle;
36 typedef typename MeshElement::gsEdgeHandle gsEdgeHandle;
37 typedef typename MeshElement::gsFaceHandle gsFaceHandle;
40 gsFace() : MeshElement() { }
44 gsFace(std::vector<gsVertexHandle>
const & vert ) : MeshElement()
47 for (
typename std::vector<gsVertexHandle>::iterator
48 it = vertices.begin(); it!= vertices.end(); ++it)
52 gsFaceHandle handle() {
return static_cast<gsFaceHandle
>(
this); }
54 gsFace(gsVertexHandle
const & v0, gsVertexHandle
const & v1, gsVertexHandle
const & v2) : MeshElement()
56 vertices.push_back(v0);
57 vertices.push_back(v1);
58 vertices.push_back(v2);
64 gsFace(gsVertexHandle
const & v0, gsVertexHandle
const & v1, gsVertexHandle
const & v2, gsVertexHandle
const & v3) : MeshElement()
66 vertices.push_back(v0);
67 vertices.push_back(v1);
68 vertices.push_back(v2);
69 vertices.push_back(v3);
70 v0->addFace( handle() );
78 uPtr clone()
const {
return uPtr(
new gsFace(*
this)); }
80 bool operator< (gsFace
const & rhs)
const
82 return ( Xless<T>(this->vertices[0],rhs.vertices[0])||
83 ( (this->vertices[0]->x() == rhs.vertices[0]->x() &&
84 this->vertices[0]->y() == rhs.vertices[0]->y() &&
85 this->vertices[0]->z() == rhs.vertices[0]->z() ) &&
86 Xless<T>(this->vertices[1],rhs.vertices[1]) )||
87 ( (this->vertices[0]->x() == rhs.vertices[0]->x() &&
88 this->vertices[0]->y() == rhs.vertices[0]->y() &&
89 this->vertices[0]->z() == rhs.vertices[0]->z() &&
90 this->vertices[1]->x() == rhs.vertices[1]->x() &&
91 this->vertices[1]->y() == rhs.vertices[1]->y() &&
92 this->vertices[1]->z() == rhs.vertices[1]->z() ) &&
93 Xless<T>(this->vertices[2],rhs.vertices[2]) ) );
95 bool operator == (gsFace
const & rhs)
const
98 this->vertices[0]->x() == rhs.vertices[0]->x() &&
99 this->vertices[0]->y() == rhs.vertices[0]->y() &&
100 this->vertices[0]->z() == rhs.vertices[0]->z() &&
101 this->vertices[1]->x() == rhs.vertices[1]->x() &&
102 this->vertices[1]->y() == rhs.vertices[1]->y() &&
103 this->vertices[1]->z() == rhs.vertices[1]->z() &&
104 this->vertices[2]->x() == rhs.vertices[2]->x() &&
105 this->vertices[2]->y() == rhs.vertices[2]->y() &&
106 this->vertices[2]->z() == rhs.vertices[2]->z() );
110 return !(*
this==rhs);
112 inline void addVertex(gsVertexHandle
const & v)
114 vertices.push_back( v );
119 void move(scalar_t
const& dx, scalar_t
const& dy, scalar_t
const& dz)
125 std::ostream &print(std::ostream &os)
const
128 for (
typename std::vector<gsVertexHandle>::const_iterator
129 it = vertices.begin(); it!= vertices.end(); ++it)
130 os<< (*it)->getId()<<
" ";
136 gsVector3d<T> orthogonalVector()
138 gsVector3d<T> result;
139 gsVector3d<T> lhs(((*vertices[1]).x()-(*vertices[0]).x()),
140 ((*vertices[1]).y()-(*vertices[0]).y()),
141 ((*vertices[1]).z()-(*vertices[0]).z()));
142 gsVector3d<T> rhs(((*vertices[2]).x()-(*vertices[0]).x()),
143 ((*vertices[2]).y()-(*vertices[0]).y()),
144 ((*vertices[2]).z()-(*vertices[0]).z()));
145 result = rhs.cross(lhs);
152 std::vector<gsVertexHandle> vertices;
153 std::vector<gsFaceHandle> nFaces;
154 std::vector<gsEdgeHandle> nEdges;
Provides gsMeshElement class - a vertex, edge, face or cell of a gsMesh.
bool operator!=(gsVertex< T > const &lhs, gsVertex< T > const &rhs)
Definition: gsVertex.h:240
This is the main header file that collects wrappers of Eigen for linear algebra.