Skip to content

This repository contains the code that returns the BSpline basis functions.

Notifications You must be signed in to change notification settings

bhagath555/Symbolic_BSpline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Symbolic_B-Spline

This repository contains the code that returns the B-Spline basis functions in symbolic/equation format. This gives new ways to explore the B-Spline basis functions, getting some new perspectives, and also helps the beginners to get feel of Isogeometric analysis by doing manual calculations with these basis functions. This also comes in handy for making manual notes and teaching B-Splines.

It is possible to generate the latex commands of the basis functions, which can be used in writing your thesis or research papers.

Requirements & Dependencies:

In order to try this code, Install the Anaconda(Jupyter Notebook). The dependent libraries (NUMPY and SYMPY) are integral packages of it, so no need to install them separately.

How to Use:

To demonstrate the usage of this tool, degree 2, B-Spline with knot vector {0,0,0,0.5,1,1,1} is considered. B-spline with these properties has 2 parametric spans (elements in FEM/IGA terminology) first one in the range {0,0.5} and other in {0.5,1}. In each element has 3 (degree+1) basis functions.

# Defining the inputs
p = 2				# Degree
knot = [0,0,0,0.5,1,1,1]	# Knot vector
xi = symp.Symbol('xi')		# Symbolic variable
simplify = True			# Simplied expression of the basis functions.
# simplify = False		# For expanded format of the basis functions.

To get basis functions of Element 1, span {0,0.5}:

elem = 1			# Element 1
basis  = bspline_elem_basis(p, knot, xi, elem, simplify)

elem1

To get basis functions of Element 2, span {0.5,1}:

elem = 2 			# Element 2
basis  = bspline_elem_basis(p, knt, xi, el, simplify)  

elem2

Converting Expressions into LATEX format:

print(sympy.latex(basis))	# Prints the latex format of all the basis functions.
# OR
print(sympy.latex(basis[0]))	# To get latex format of any one of the basis function.

This procedure is applied for any other degree and knot vector.

Hope this tool helps you in studying and developing deeper understanding of B-spline and other related topics like NURBS, Isogeometric analysis.

Please, give a star to this repository, if you like it. Raise an issue, if you would like to see any new feature need to be added. Thank you.

About

This repository contains the code that returns the BSpline basis functions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published