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: - coors : array
The coordinates of the approximated points.
- ncp : int
The number of control points.
- knot_type : str
The knot vector type.
- knots : array
The knot vector.
- alpha : float
- The parameter vector distribution:
1.0 = chordal 0.5 = centripetal
- do_eval : bool
Evaluate the curve coordinates?
- do_param_correction : bool
Perform parametric corrections to improve the approximation?
-
static
basis_function_dg
(degree, t, knots, n)[source]¶ B-spline basis functions.
Parameters: - degree : int
The degree of the spline function.
- t : array
The parametric vector.
- knots : array
The knot vector.
- n : int
The number of intervals.
Returns: - bfun : array
The spline basis function evaluated for given values.
-
static
basis_function_dg0
(t, knots, n)[source]¶ Basis function: degree = 0
Parameters: - t : array
The parametric vector.
- knots : array
The knot vector.
- n : int
The number of intervals.
Returns: - bfun : array
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_ax : bool
Return an axes object?
- ax : axes object
The axes to which will be drawn.
- color : str
Line color.
- cp_id : bool
If True, label control points.
-
eval
(t=None, cp_coors=None)[source]¶ Evaluate the coordinates of the bpsline curve.
Parameters: - t : array
The parameter vector of the B-spline.
- cp_coors : array
The coordinates of the control points.
-
eval_basis
(t=None, return_val=False)[source]¶ Evaluate the basis of the bpsline.
Parameters: - t : array
The parameter vector of the B-spline.
-
get_control_points
()[source]¶ Get the B-spline control points.
Returns: - coors : array
The coordinates of control points.
-
insert_knot
(new)[source]¶ Insert a new knot into the knot vector.
Parameters: - new : float
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_type : str
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: - coors : array
The coordinates of approximated points.
-
set_control_points
(coors, cyclic_form=False)[source]¶ Set the B-spline control points.
Parameters: - coors : array
The coordinates of unique control points.
- cyclic_form : bool
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: - coors : array
The coordinates of the approximated points.
- ncp : tuple of int
The number of control points.
-
draw
(ret_ax=False, ax=None)[source]¶ Draw B-spline surface.
Parameters: - ret_ax : bool
Return an axes object?
- ax : axes object
The axes to which will be drawn.
-
eval
(t=(None, None), cp_coors=None)[source]¶ Evaluate the coordinates of the bpsline curve.
Parameters: - t : tuple of array
The parametric vector of the B-splines.
- cp_coors : array
The coordinates of the control points.
-
get_control_points
()[source]¶ Get the B-spline surface control points.
Returns: - coors : array
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_type : tuple of str
The knot vector types.
- knot_data : tuple of ANY
The extra knot data.
-
set_approx_points
(coors)[source]¶ Set the coordinates of approximated points.
Parameters: - coors : array
The coordinates of approximated points.
-
set_control_points
(coors, cyclic_form=False)[source]¶ Set the B-spline control points.
Parameters: - coors : array
The coordinates of unique control points.
- cyclic_form : bool
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: - n : tuple 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.