https://github.com/cran/robCompositions
Raw File
Tip revision: 6cf109eab116e889a3e3bcc1309cbdcc254895e8 authored by Matthias Templ on 25 August 2023, 15:30:06 UTC
version 2.4.1
Tip revision: 6cf109e
bspline.h
#ifndef HH_BSPLINE_HH
#define HH_BSPLINE_HH
#include <vector>
#include <Eigen/Dense>
/*! \file
  @brief Compute bsplines functions
*/
namespace bspline{
  /*!
	@brief	Find the knot span of the parametric point t.

	@note	This is NOT	Algorithm A2.1 from 'The NURBS BOOK' pg68
			as that algorithm only works for nonperiodic
			knot vectors, nonetheless the results should
			be EXACTLY the same if U is nonperiodic

	@param p Spline degree
	@param t Parametric point
	@param U Knot sequence
	@return	Knot span

  */
  unsigned int
  findspan
  (int p, double t, const std::vector<double> &U);

  /*!
  	@brief	Compute the functions of the basis in the parametric point t

  	@note	Algorithm A2.2 from 'The NURBS BOOK' pg70.

  	@param i (Input) Knot span (from findspan())
  	@param t (Input) Parametric point
  	@param p (Input) Spline degree
  	@param U (Input) Knot sequence
  	@param N (Output) Vector of the functions of the basis (p+1 dimensional)
  */
  void
  basisfun
  (unsigned int i, double t, int p, const std::vector<double> &U, Eigen::ArrayXd &N);
}

#endif
back to top