30 typedef memory::shared_ptr< gsVertex >
Ptr;
33 typedef memory::unique_ptr< gsVertex >
uPtr;
36 typedef gsMeshElement<T> MeshElement;
37 typedef typename MeshElement::gsFaceHandle gsFaceHandle;
44 template<
typename OtherDerived>
45 gsVertex(
const gsEigen::MatrixBase<OtherDerived>& other) :
51 MeshElement(),
gsVector3d<T>(x,y,
z),sharp(0), numEdges(0), data()
57 MeshElement(),
gsVector3d<T>(u),sharp(0), numEdges(0), data()
63 MeshElement(),
gsVector3d<T>(),sharp(0),numEdges(0), data()
67 GISMO_ASSERT(r<=3,
"Invalid input in gsVertex constructor");
70 this->tail(3-r).setZero();
78 void setCoords(gsVector<T>
const & coord)
80 this->gsVector3d<T>::operator=(coord);
85 this->gsVector3d<T>::operator=(other);
95 void move(scalar_t dx, scalar_t dy, scalar_t dz)
105 {
faces.push_back( f ); }
108 inline T
x ()
const {
return (*
this)(0); }
110 inline T
y ()
const {
return (*
this)(1); }
112 inline T
z ()
const {
return (*
this)(2); }
114 inline T &
x () {
return (*
this)(0); }
116 inline T &
y () {
return (*
this)(1); }
118 inline T &
z () {
return (*
this)(2); }
120 std::ostream &print(std::ostream &os)
const
122 os <<
"Vertex( " << this->
x() <<
" " << this->
y() <<
" " << this->
z() <<
" )\n";
128 std::vector<gsVertexHandle> nVertices;
142 {
return a->
x()< b->
x() || ( a->
x()==b->
x() && a->
y()<b->
y() )
143 || ( a->
x()==b->
x() && a->
y()==b->
y() && a->
z()<b->
z()); }
146 static bool Yless(
typename gsVertex<T>::gsVertexHandle
const & a,
147 typename gsVertex<T>::gsVertexHandle
const & b )
148 {
return a->y()< b->y() || ( a->y()==b->y() && a->x()<b->x() ); }
150 static bool Zless(
typename gsVertex<T>::gsVertexHandle
const & a,
151 typename gsVertex<T>::gsVertexHandle
const & b )
152 {
return a->z()< b->z(); }
157 struct lexCompareVHandle
159 bool operator() (
typename gsVertex<T>::gsVertexHandle
const & lhs,
160 typename gsVertex<T>::gsVertexHandle
const & rhs)
const
161 {
return lhs->x()< rhs->x() || ( lhs->x()==rhs->x() && lhs->y()<rhs->y() )
162 || ( lhs->x()==rhs->x() && lhs->y()==rhs->y() && lhs->z()<rhs->z()); }
166 T length(gsVertex<T>
const & vert)
173 bool operator < (typename gsVertex<T>::gsVertexHandle
const & lhs,
174 typename gsVertex<T>::gsVertexHandle
const & rhs)
176 return !(lhs->x() < rhs->x() || (lhs->x() == rhs->x() && lhs->y() < rhs->y())
177 || (lhs->x() == rhs->x() && lhs->y() == rhs->y() && lhs->z() < rhs->z()));
180 bool operator > (
typename gsVertex<T>::gsVertexHandle
const & lhs,
181 typename gsVertex<T>::gsVertexHandle
const & rhs)
183 return !(lhs->x() > rhs->x() || (lhs->x() == rhs->x() && lhs->y() > rhs->y())
184 || (lhs->x() == rhs->x() && lhs->y() == rhs->y() && lhs->z() > rhs->z()));
203 return (lhs.
x()==rhs.
x())&&
210 bool operator < (gsVertex<T>
const & lhs,gsVertex<T>
const & rhs)
212 return (lhs.x()> rhs.x() || ( lhs.x()==rhs.x() && lhs.y()>rhs.y() )
213 || ( lhs.x()==rhs.x() && lhs.y()==rhs.y() && lhs.z()>rhs.z()));
228 return (lhs.
x() < rhs.
x() ||
229 (lhs.
x() == rhs.
x() && lhs.
y() < rhs.
y()) ||
230 (lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y() && lhs.
z() < rhs.
z()));
243 return !(lhs.
x()== rhs.
x()&& lhs.
y()==rhs.
y()&& lhs.
z()==rhs.
z());
A fixed-size, statically allocated 3D vector.
Definition: gsVector.h:218
void addFace(gsFaceHandle const &f)
Adds a gsFaceHandle f to the list of faces adjaent to this vertex.
Definition: gsVertex.h:104
Provides gsMeshElement class - a vertex, edge, face or cell of a gsMesh.
memory::shared_ptr< gsVertex > Ptr
Shared pointer for gsVertex.
Definition: gsVertex.h:30
#define index_t
Definition: gsConfig.h:32
T & x()
Definition: gsVertex.h:114
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
T & y()
Definition: gsVertex.h:116
std::vector< gsFaceHandle > faces
List of faces adjacent to this vertex.
Definition: gsVertex.h:133
uPtr clone() const
Clone Function (deep copy)
Definition: gsVertex.h:91
gsVertex()
Constructor.
Definition: gsVertex.h:42
bool operator!=(gsVertex< T > const &lhs, gsVertex< T > const &rhs)
Definition: gsVertex.h:240
gsVertex(gsVector< T > const &u)
Constructor, takes a gsVector.
Definition: gsVertex.h:62
void move(scalar_t dx, scalar_t dy, scalar_t dz)
Moves a gsVertex relatively.
Definition: gsVertex.h:95
T x() const
Definition: gsVertex.h:108
gsVertex(gsVector3d< T > const &u)
Constructor, takes a gsVector3d.
Definition: gsVertex.h:56
T y() const
Definition: gsVertex.h:110
This is the main header file that collects wrappers of Eigen for linear algebra.
gsVertex(scalar_t x, scalar_t y, scalar_t z=0)
Constructor, take 3 scalars.
Definition: gsVertex.h:50
T & z()
Definition: gsVertex.h:118
memory::unique_ptr< gsVertex > uPtr
Unique pointer for gsVertex.
Definition: gsVertex.h:33
T z() const
Definition: gsVertex.h:112
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26