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.

draw_basis()[source]

Draw B-spline curve.

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.

get_knot_vector()[source]

Return the knot vector.

Returns:
knotsarray

The knot vector.

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?

set_knot_vector(knots)[source]

Set the knot vector.

Parameters:
knotsarray

The knot vector.

set_param(t)[source]

Set the B-spline parametric vector.

Parameters:
tarray

The parameter vector of the B-spline.

set_param_n(n=100, knot_range=(0.0, 1.0))[source]

Generate the B-spline parametric vector using the number of steps.

Parameters:
narray

The number of steps in the B-spline parametric vector.

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.

write_control_polygon_vtk(filename, float_format='%.6f')[source]

Write the control polygon to VTK file.

Parameters:
filename: str

Name of the VTK file.

float_format: str

Float formating.

write_surface_vtk(filename, float_format='%.6f')[source]

Write the spline surface to VTK file.

Parameters:
filename: str

Name of the VTK file.

float_format: str

Float formating.

sfepy.mesh.bspline.approximation_example()[source]

The example of using BSplineSurf for approximation of the surface given by the set of points.

sfepy.mesh.bspline.get_2d_points(is3d=False)[source]

Returns the set of points.

Parameters:
is3dbool

3D coordinates?

sfepy.mesh.bspline.main(argv)[source]
sfepy.mesh.bspline.simple_example()[source]

The example of using B-spline class.

sfepy.mesh.bspline.to_ndarray(a)[source]