52 map.first->eval_into(x, px);
53 map.second->eval_into(x, py);
63 tangent = p.col(0)-line.col(0);
65 h = tangent.norm()/n_points ;
67 tangent/=tangent.norm();
75 for(
int i=0; i!=n_points; i++)
76 { next = next + h*tangent;
84 Jmap.row(0) = map.first->jacobian(current );
85 Jmap.row(1) = map.second->jacobian(current);
87 if ( math::abs( Jmap.determinant() ) < 0.0001)
89 gsDebug<<
"\n trace line: \n Jacobian vanished at : " << current.transpose() <<
"\n"
90 "with Jacobian = "<< math::abs( Jmap.determinant() )<<
"\n \n";
96 delta = Jmap.inverse()*(next.col(0)-line.col(0));
99 map.first->eval_into(current,px);
100 map.second->eval_into(current,py);
108 while((--loops > 0) && ( (line-next).norm() > tolerance ) );
134void gsTraceCurve( std::pair<gsFunction<T>*,gsFunction<T>*> & map,
135 gsMatrix<T>
const & x, gsBSpline<T> * bs,gsMatrix<T> & result,
const int n_points = 50,
136 const T tolerance = 0.0001)
142 result.resize(2,n_points-1);
144 gsMatrix<T> current (2,1);
145 gsMatrix<T> next (2,1), delta;
146 gsMatrix<T> line(2,1), px, py;
147 gsMatrix<T> Jmap (2,2);
150 gsMatrix<T> pts = gsPointGrid<T>(0,1,n_points);
152 gsMatrix<T> ev = bs->eval(pts);
165 result.col(n_points-2)= current;
170 map.first->eval_into(current, px);
171 map.second->eval_into(current, py);
179 for(
int i=2; i!=n_points; i++)
190 Jmap.row(0) = map.first->jacobian(current);
191 Jmap.row(1) = map.second->jacobian(current);
194 delta = Jmap.inverse()*(next.col(0)-line.col(0));
202 map.first->eval_into(current,px);
203 map.second->eval_into(current,py);
212 while((--loops > 0) && ( (line-next).norm() > tolerance ) );
215 result.col(n_points-i-1) = current;
250 const T tolerance = 0.0001)
262 gsMatrix<T> discretI = gsPointGrid<T>(t0,t1, n_points );
264 map.first->eval_into(current, px);
265 map.second->eval_into(current, py);
269 result.resize(2,ev.cols()+1);
273 for(i =1; i< ev.cols()&& cont; i++)
280 Jmap.row(0) = map.first->jacobian(current);
281 Jmap.row(1) = map.second->jacobian(current);
284 if ( math::abs( Jmap.determinant() ) < 0.01)
286 gsDebug<<
"Jacobian vanished at : " << current.transpose() <<
"\n"
287 "with Jacobian = "<< math::abs( Jmap.determinant() )<<
"\n \n";
293 delta = Jmap.inverse()*(next.col(0)-line.col(0));
297 map.first->eval_into(current,px);
298 map.second->eval_into(current,py);
306 while((--loops > 0) && ( (line-next).norm() > tolerance ) );
308 result.col(i) = current;
312 result.conservativeResize( gsEigen::NoChange, i);
A B-spline function of one argument, with arbitrary target dimension.
Definition gsBSpline.h:51
gsMatrix< T > eval(const gsMatrix< T > &u) const
Evaluate the function,.
Definition gsFunctionSet.hpp:120
A function from a n-dimensional domain to an m-dimensional image.
Definition gsFunction.h:60
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
void gsTraceLine(std::pair< gsFunction< T > *, gsFunction< T > * > &map, gsMatrix< T > const &x, gsMatrix< T > const &p, gsMatrix< T > &result)
Definition gsTraceCurve.hpp:36
Provides declaration of BSplineBasis class.
#define index_t
Definition gsConfig.h:32
#define gsDebug
Definition gsDebug.h:61
Provides declaration of FunctionExpr class.
Provides declaration of Function abstract interface.
This is the main header file that collects wrappers of Eigen for linear algebra.
Provides functions to generate structured point data.
The G+Smo namespace, containing all definitions for the library.
void gsTraceCurvePart(std::pair< gsFunction< T > *, gsFunction< T > * > &map, gsMatrix< T > const &x, gsBSpline< T > *bs, T t0, T t1, gsMatrix< T > &result, const int n_points=50, const T tolerance=0.0001)
Definition gsTraceCurve.hpp:247