G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsCurve.hpp
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <gsUtils/gsPointGrid.h>
17 #include <gsUtils/gsMesh/gsMesh.h>
18 
19 namespace gismo
20 {
21 
22 template<class T>
23 short_t gsCurve<T>::degree() const
24 {
25  return this->basis().degree(0);
26 }
27 
28 template<class T>
29 void gsCurve<T>::toMesh(gsMesh<T> & msh, int npoints) const
30 {
31  const gsMatrix<T> param = this->parameterRange();
32  const gsMatrix<T> paramSamples = gsPointGrid<T>(param(0,0), param(0,1), npoints);
33  //const bool zzero = ( this->geoDim()==2 );
34 
35  gsMatrix<T> cp; // Curve point
36 
37  this->eval_into(paramSamples.col(0), cp);
38 
39  typename gsMesh<T>::VertexHandle v1,
40  //v0 = msh.addVertex( cp(0,0), cp(1,0), zzero ? (T)(0) : cp(2,0) );
41  v0 = msh.addVertex( cp );
42 
43  for ( int i = 1; i<npoints; ++i)
44  {
45  this->eval_into(paramSamples.col(i), cp);
46  //v1 = msh.addVertex( cp(0,0), cp(1,0), zzero ? (T)(0) : cp(2,0) );
47  v1 = msh.addVertex( cp );
48  msh.addEdge(v0, v1);
49  v0 = v1;
50  }
51 }
52 
53 } // namespace gismo
#define short_t
Definition: gsConfig.h:35
Provides declaration of the Mesh class.
Provides functions to generate structured point data.