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) :
46 MeshElement(),
gsVector3d<T>(other),sharp(0), numEdges(0), data()
52 MeshElement(),
gsVector3d<T>(
x,
y,
z),sharp(0), numEdges(0), data()
58 MeshElement(),
gsVector3d<T>(u),sharp(0), numEdges(0), data()
64 MeshElement(),
gsVector3d<T>(),sharp(0),numEdges(0), data()
68 GISMO_ASSERT(r<=3,
"Invalid input in gsVertex constructor");
71 this->tail(3-r).setZero();
78 MeshElement(other),
gsVector3d<T>(other), sharp(other.sharp), numEdges(other.numEdges), data(other.data)
84 MeshElement::operator=(other);
85 gsVector3d<T>::operator=(other);
87 numEdges = other.numEdges;
93 virtual ~gsVertex() { };
96 void setCoords(gsVector<T>
const & coord)
98 this->gsVector3d<T>::operator=(coord);
107 void move(scalar_t dx, scalar_t dy, scalar_t dz)
117 {
faces.push_back( f ); }
120 inline T
x ()
const {
return (*
this)(0); }
122 inline T
y ()
const {
return (*
this)(1); }
124 inline T
z ()
const {
return (*
this)(2); }
126 inline T &
x () {
return (*
this)(0); }
128 inline T &
y () {
return (*
this)(1); }
130 inline T &
z () {
return (*
this)(2); }
132 std::ostream &print(std::ostream &os)
const
134 os <<
"Vertex( " << this->
x() <<
" " << this->
y() <<
" " << this->
z() <<
" )\n";
140 std::vector<gsVertexHandle> nVertices;
154 {
return a->
x()< b->
x() || ( a->
x()==b->
x() && a->
y()<b->
y() )
155 || ( a->
x()==b->
x() && a->
y()==b->
y() && a->
z()<b->
z()); }
158 static bool Yless(
typename gsVertex<T>::gsVertexHandle
const & a,
159 typename gsVertex<T>::gsVertexHandle
const & b )
160 {
return a->y()< b->y() || ( a->y()==b->y() && a->x()<b->x() ); }
162 static bool Zless(
typename gsVertex<T>::gsVertexHandle
const & a,
163 typename gsVertex<T>::gsVertexHandle
const & b )
164 {
return a->z()< b->z(); }
169struct lexCompareVHandle
171 bool operator() (
typename gsVertex<T>::gsVertexHandle
const & lhs,
172 typename gsVertex<T>::gsVertexHandle
const & rhs)
const
173 {
return lhs->x()< rhs->x() || ( lhs->x()==rhs->x() && lhs->y()<rhs->y() )
174 || ( lhs->x()==rhs->x() && lhs->y()==rhs->y() && lhs->z()<rhs->z()); }
178T length(gsVertex<T>
const & vert)
185bool operator < (
typename gsVertex<T>::gsVertexHandle
const & lhs,
186 typename gsVertex<T>::gsVertexHandle
const & rhs)
188 return !(lhs->x() < rhs->x() || (lhs->x() == rhs->x() && lhs->y() < rhs->y())
189 || (lhs->x() == rhs->x() && lhs->y() == rhs->y() && lhs->z() < rhs->z()));
192bool operator > (
typename gsVertex<T>::gsVertexHandle
const & lhs,
193 typename gsVertex<T>::gsVertexHandle
const & rhs)
195 return !(lhs->x() > rhs->x() || (lhs->x() == rhs->x() && lhs->y() > rhs->y())
196 || (lhs->x() == rhs->x() && lhs->y() == rhs->y() && lhs->z() > rhs->z()));
215 return (lhs.
x()==rhs.
x())&&
222bool operator < (gsVertex<T>
const & lhs,gsVertex<T>
const & rhs)
224 return (lhs.x()> rhs.x() || ( lhs.x()==rhs.x() && lhs.y()>rhs.y() )
225 || ( lhs.x()==rhs.x() && lhs.y()==rhs.y() && lhs.z()>rhs.z()));
240 return (lhs.
x() < rhs.
x() ||
241 (lhs.
x() == rhs.
x() && lhs.
y() < rhs.
y()) ||
242 (lhs.
x() == rhs.
x() && lhs.
y() == rhs.
y() && lhs.
z() < rhs.
z()));
255 return !(lhs.
x()== rhs.
x()&& lhs.
y()==rhs.
y()&& lhs.
z()==rhs.
z());
A fixed-size, statically allocated 3D vector.
Definition gsVector.h:219
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
gsVertex class that represents a 3D vertex for a gsMesh.
Definition gsVertex.h:27
T & x()
Definition gsVertex.h:126
std::vector< gsFaceHandle > faces
List of faces adjacent to this vertex.
Definition gsVertex.h:145
gsVertex(scalar_t x, scalar_t y, scalar_t z=0)
Constructor, take 3 scalars.
Definition gsVertex.h:51
T & y()
Definition gsVertex.h:128
T & z()
Definition gsVertex.h:130
void move(scalar_t dx, scalar_t dy, scalar_t dz)
Moves a gsVertex relatively.
Definition gsVertex.h:107
memory::shared_ptr< gsVertex > Ptr
Shared pointer for gsVertex.
Definition gsVertex.h:30
memory::unique_ptr< gsVertex > uPtr
Unique pointer for gsVertex.
Definition gsVertex.h:33
gsVertex(gsVector< T > const &u)
Constructor, takes a gsVector.
Definition gsVertex.h:63
T x() const
Definition gsVertex.h:120
T z() const
Definition gsVertex.h:124
T y() const
Definition gsVertex.h:122
gsVertex()
Constructor.
Definition gsVertex.h:42
void addFace(gsFaceHandle const &f)
Adds a gsFaceHandle f to the list of faces adjaent to this vertex.
Definition gsVertex.h:116
gsVertex(gsVector3d< T > const &u)
Constructor, takes a gsVector3d.
Definition gsVertex.h:57
uPtr clone() const
Clone Function (deep copy)
Definition gsVertex.h:103
#define index_t
Definition gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
This is the main header file that collects wrappers of Eigen for linear algebra.
Provides gsMeshElement class - a vertex, edge, face or cell of a gsMesh.
The G+Smo namespace, containing all definitions for the library.
bool operator!=(gsVertex< T > const &lhs, gsVertex< T > const &rhs)
Definition gsVertex.h:252