https://mooseframework.inl.gov
BSpline.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
13 #include "libmesh/point.h"
14 #include <vector>
15 
16 namespace Moose
17 {
25 class BSpline
26 {
27 public:
28  BSpline(const unsigned int degree,
29  const libMesh::Point & start_point,
30  const libMesh::Point & end_point,
31  const libMesh::RealVectorValue & start_direction,
32  const libMesh::RealVectorValue & end_direction,
33  const unsigned int cps_per_half,
34  const libMesh::Real sharpness);
35 
42  libMesh::Point getPoint(const libMesh::Real t) const;
43 
44 private:
48  std::vector<libMesh::Real> buildKnotVector() const;
49 
53  std::vector<libMesh::Point> createControlPoints() const;
54 
64  libMesh::Real CdBBasis(const libMesh::Real t, const unsigned int i, const unsigned int j) const;
65 
72  libMesh::Real firstCoeff(const libMesh::Real t, const unsigned int i, const unsigned int j) const;
73 
81  secondCoeff(const libMesh::Real t, const unsigned int i, const unsigned int j) const;
82 
84  const unsigned int _degree;
94  const unsigned int _cps_per_half;
98  const std::vector<libMesh::Point> _control_points;
102  const std::vector<libMesh::Real> _knot_vector;
103 };
104 }
const libMesh::Real _sharpness
sharpness of the curve
Definition: BSpline.h:96
const unsigned int _cps_per_half
number of control points per half of the spline (vertex is auto-included)
Definition: BSpline.h:94
libMesh::Real secondCoeff(const libMesh::Real t, const unsigned int i, const unsigned int j) const
Submethod used in CdBBasis routine.
Definition: BSpline.C:127
const libMesh::RealVectorValue _end_dir
ending direction of spline
Definition: BSpline.h:92
const libMesh::RealVectorValue _start_dir
starting direction of spline
Definition: BSpline.h:90
const libMesh::Point _end_point
ending point of spline
Definition: BSpline.h:88
std::vector< libMesh::Real > buildKnotVector() const
Internal method for building the knot vector given the degree and control points. ...
Definition: BSpline.C:63
libMesh::Real CdBBasis(const libMesh::Real t, const unsigned int i, const unsigned int j) const
Evaluates the the basis function for a B-Spline according to the Cox-de-Boor recursive formula...
Definition: BSpline.C:101
libMesh::Point getPoint(const libMesh::Real t) const
Evaluate the BSpline interpolation at given value of t.
Definition: BSpline.C:40
const std::vector< libMesh::Point > _control_points
The control points.
Definition: BSpline.h:98
std::vector< libMesh::Point > createControlPoints() const
Creates a vector control points from the SplineUtils set of functions.
Definition: BSpline.C:53
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const libMesh::Point _start_point
starting point of spline
Definition: BSpline.h:86
Class implementing a uniform clamped B-Spline curve.
Definition: BSpline.h:25
const std::vector< libMesh::Real > _knot_vector
The knot vector.
Definition: BSpline.h:102
BSpline(const unsigned int degree, const libMesh::Point &start_point, const libMesh::Point &end_point, const libMesh::RealVectorValue &start_direction, const libMesh::RealVectorValue &end_direction, const unsigned int cps_per_half, const libMesh::Real sharpness)
Definition: BSpline.C:20
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
libMesh::Real firstCoeff(const libMesh::Real t, const unsigned int i, const unsigned int j) const
Submethod used in CdBBasis routine.
Definition: BSpline.C:115
const unsigned int _degree
The polynomial degree of the B-Spline.
Definition: BSpline.h:84