# sfepy.mesh.bspline module

class sfepy.mesh.bspline.BSpline(degree=3, is_cyclic=False, ncp=0)

  B-spline curve representation

  approximate(coors, ncp=None, knot_type='clamped', knots=None, alpha=0.5, do_eval=False, do_param_correction=False)

    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)

    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)

    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)

    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.

  draw_basis()

    Draw B-spline curve.

  eval(t=None, cp_coors=None)

    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)

    Evaluate the basis of the bpsline.

    Parameters:
      t array

        The parameter vector of the B-spline.

  get_control_points()

    Get the B-spline control points.

    Returns:
      coors array

        The coordinates of control points.

  get_knot_vector()

    Return the knot vector.

    Returns:
      knots array

        The knot vector.

  insert_knot(new)

    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))

    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)

    Set the coordinates of approximated points.

    Parameters:
      coors array

        The coordinates of approximated points.

  set_control_points(coors, cyclic_form=False)

    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_knot_vector(knots)

    Set the knot vector.

    Parameters:
      knots array

        The knot vector.

  set_param(t)

    Set the B-spline parametric vector.

    Parameters:
      t array

        The parameter vector of the B-spline.

  set_param_n(n=100, knot_range=(0.0, 1.0))

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

    Parameters:
      n array

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

class sfepy.mesh.bspline.BSplineSurf(degree=(3, 3), is_cyclic=(False, False))

  B-spline surface representation

  approximate(coors, ncp, do_eval=False)

    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)

    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)

    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()

    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))

    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)

    Set the coordinates of approximated points.

    Parameters:
      coors array

        The coordinates of approximated points.

  set_control_points(coors, cyclic_form=False)

    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))

    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.

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

    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')

    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()

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

sfepy.mesh.bspline.get_2d_points(is3d=False)

  Returns the set of points.

  Parameters:
    is3d bool

      3D coordinates?

sfepy.mesh.bspline.main(argv)

sfepy.mesh.bspline.simple_example()

  The example of using B-spline class.

sfepy.mesh.bspline.to_ndarray(a)