sfepy.mesh.bspline module¶
- class sfepy.mesh.bspline.BSpline(degree=3, is_cyclic=False, ncp=0)[source]¶
B-spline curve representation
- approximate(coors, ncp=None, knot_type='clamped', knots=None, alpha=0.5, do_eval=False, do_param_correction=False)[source]¶
Approximate set of points by the B-spline curve.
- Parameters:
- coorsarray
The coordinates of the approximated points.
- ncpint
The number of control points.
- knot_typestr
The knot vector type.
- knotsarray
The knot vector.
- alphafloat
- The parameter vector distribution:
1.0 = chordal 0.5 = centripetal
- do_evalbool
Evaluate the curve coordinates?
- do_param_correctionbool
Perform parametric corrections to improve the approximation?
- static basis_function_dg(degree, t, knots, n)[source]¶
B-spline basis functions.
- Parameters:
- degreeint
The degree of the spline function.
- tarray
The parametric vector.
- knotsarray
The knot vector.
- nint
The number of intervals.
- Returns:
- bfunarray
The spline basis function evaluated for given values.
- static basis_function_dg0(t, knots, n)[source]¶
Basis function: degree = 0
- Parameters:
- tarray
The parametric vector.
- knotsarray
The knot vector.
- nint
The number of intervals.
- Returns:
- bfunarray
The spline basis function evaluated for given values.
- draw(ret_ax=False, ax=None, color='r', cp_id=True)[source]¶
Draw B-spline curve.
- Parameters:
- ret_axbool
Return an axes object?
- axaxes object
The axes to which will be drawn.
- colorstr
Line color.
- cp_idbool
If True, label control points.
- eval(t=None, cp_coors=None)[source]¶
Evaluate the coordinates of the bpsline curve.
- Parameters:
- tarray
The parameter vector of the B-spline.
- cp_coorsarray
The coordinates of the control points.
- eval_basis(t=None, return_val=False)[source]¶
Evaluate the basis of the bpsline.
- Parameters:
- tarray
The parameter vector of the B-spline.
- get_control_points()[source]¶
Get the B-spline control points.
- Returns:
- coorsarray
The coordinates of control points.
- insert_knot(new)[source]¶
Insert a new knot into the knot vector.
- Parameters:
- newfloat
The new knot value.
- make_knot_vector(knot_type='clamped', knot_data=None, knot_range=(0.0, 1.0))[source]¶
Create a knot vector of the requested type.
- Parameters:
- knot_typestr
The knot vector type: clamped/cyclic/userdef.
- knot_data
The extra knot data.
- set_approx_points(coors)[source]¶
Set the coordinates of approximated points.
- Parameters:
- coorsarray
The coordinates of approximated points.
- set_control_points(coors, cyclic_form=False)[source]¶
Set the B-spline control points.
- Parameters:
- coorsarray
The coordinates of unique control points.
- cyclic_formbool
Are the control points in the cyclic form?
- class sfepy.mesh.bspline.BSplineSurf(degree=(3, 3), is_cyclic=(False, False))[source]¶
B-spline surface representation
- approximate(coors, ncp, do_eval=False)[source]¶
Approximate set of points by the B-spline surface.
- Parameters:
- coorsarray
The coordinates of the approximated points.
- ncptuple of int
The number of control points.
- draw(ret_ax=False, ax=None)[source]¶
Draw B-spline surface.
- Parameters:
- ret_axbool
Return an axes object?
- axaxes object
The axes to which will be drawn.
- eval(t=(None, None), cp_coors=None)[source]¶
Evaluate the coordinates of the bpsline curve.
- Parameters:
- ttuple of array
The parametric vector of the B-splines.
- cp_coorsarray
The coordinates of the control points.
- get_control_points()[source]¶
Get the B-spline surface control points.
- Returns:
- coorsarray
The coordinates of control points.
- make_knot_vector(knot_type=('clamped', 'clamped'), knot_data=(None, None))[source]¶
Create a knot vector of the requested type.
- Parameters:
- knot_typetuple of str
The knot vector types.
- knot_datatuple of ANY
The extra knot data.
- set_approx_points(coors)[source]¶
Set the coordinates of approximated points.
- Parameters:
- coorsarray
The coordinates of approximated points.
- set_control_points(coors, cyclic_form=False)[source]¶
Set the B-spline control points.
- Parameters:
- coorsarray
The coordinates of unique control points.
- cyclic_formbool
Are the control points in the cyclic form?
- set_param_n(n=(100, 100))[source]¶
Generate the B-spline parametric vector using the number of steps.
- Parameters:
- ntuple of array
The number of steps in the B-spline parametric vectors.
- sfepy.mesh.bspline.approximation_example()[source]¶
The example of using BSplineSurf for approximation of the surface given by the set of points.