rofunc.utils.datalab.data_generator.bezier#

1.  Module Contents#

1.1.  Functions#

comb

get_bezier_curve

evaluate_bezier

Generate the Bezier curve from points.

plot_bezier

Plot the Bezier curve, either in 2D or 3D.

multi_bezier_demos

Generate multiple Bezier curves as demonstrations.

1.2.  API#

rofunc.utils.datalab.data_generator.bezier.comb(n, k)[source]#
rofunc.utils.datalab.data_generator.bezier.get_bezier_curve(points)[source]#
rofunc.utils.datalab.data_generator.bezier.evaluate_bezier(points, total)[source]#

Generate the Bezier curve from points.

Parameters:
  • points – points for shaping the Bezier curve

  • total – the number of points on the Bezier curve

Returns:

rofunc.utils.datalab.data_generator.bezier.plot_bezier(bx, by, x, y, bz=None, z=None, ax=None)[source]#

Plot the Bezier curve, either in 2D or 3D.

Example:

>>> from rofunc.utils.datalab.data_generator.bezier import plot_bezier
>>> import numpy as np
>>> demo_points = np.array([[0, 0], [-1, 8], [4, 3], [2, 1], [4, 3]])
>>> bx, by = evaluate_bezier(demo_points, 50)[:, 0], evaluate_bezier(demo_points, 50)[:, 1]
>>> x, y = demo_points[:, 0], demo_points[:, 1]
>>> plot_bezier(bx, by, x, y)
Parameters:
  • bx – the x coordinates of the Bezier curve

  • by – the y coordinates of the Bezier curve

  • x – the x coordinates of the demonstration points

  • y – the y coordinates of the demonstration points

  • bz – the z coordinates of the Bezier curve, default None

  • z – the z coordinates of the demonstration points, default None

  • ax – the axis to plot the Bezier curve, default None

Returns:

rofunc.utils.datalab.data_generator.bezier.multi_bezier_demos(demo_points, ax=None)[source]#

Generate multiple Bezier curves as demonstrations.

Example:

>>> from rofunc.utils.datalab.data_generator.bezier import multi_bezier_demos
>>> import numpy as np
>>> demo_points = np.array([[[0, 0], [-1, 8], [4, 3], [2, 1], [4, 3]],
...                         [[0, -2], [-1, 7], [3, 2.5], [2, 1.6], [4, 3]],
...                         [[0, -1], [-1, 8], [4, 5.2], [2, 1.1], [4, 3.5]]])
>>> demos_x = multi_bezier_demos(demo_points)
Parameters:
  • demo_points – points for shaping the Bezier curve

  • ax – the axis to plot the Bezier curves, default None

Returns: