Salome HOME
Task #3230: Sketcher: create a curve passing through selected points or vertices...
[modules/shaper.git] / src / SketchPlugin / doc / curveFittingFeature.rst
1 .. |curvefitting.icon|    image:: images/curvefitting.png
2
3 Curve Fitting
4 =============
5
6 The Curve Fitting is a tool to create a curve by a set of given points.
7
8 To start this operation:
9
10 #. select *Sketch - > Curve fitting* item in the Main Menu or
11 #. click |curvefitting.icon| **Curve fitting** button in the Sketch toolbar:
12
13 There are 2 algorithms for the curve creation:
14
15 - **Interpolation** - the curve passes exactly through the selected points;
16 - **Approximation** - curve passes near the selected points to some extent.
17
18 Both algorithms have additional options:
19
20 - **Periodic** - forces the created curve to be smooth periodic curve;
21 - **Closed** - produces closed, but non-periodic curve. As a result, it has the same start and end points, but it may be connected non-smoothly there;
22 - **Create control polygon** - if the fitting curve is a B-spline curve, this option will create it's control polygon.
23
24
25 Interpolation
26 """""""""""""
27
28 .. image:: images/curvefitting_panel_interpolation.png
29    :align: center
30
31 Select the list of points to create a curve. The curve will pass directly through these points in the given order.
32
33 Clicking the **Reorder points** button will change the order of selected points to minimize the distances between the neighbors.
34
35 **TUI Command**:
36
37 .. py:function:: Sketch_1.addInterpolation(points, periodic = False, closed = False)
38
39     :param list: points for the curve.
40     :param boolean: flag to make the curve periodic.
41     :param boolean: flag to make the curve closed but not periodic.
42     :return: Created B-spline curve.
43
44 Result
45 """"""
46
47 The created B-spline curve appears in the view.
48
49 .. image:: images/curvefitting_interpolation_res.png
50            :align: center
51
52 .. centered::
53    Interpolation curve (non-closed, periodic and closed)
54
55 **See Also** a sample TUI Script of :ref:`tui_create_interpolation` operation.
56
57
58 Approximation
59 """""""""""""
60
61 .. image:: images/curvefitting_panel_approximation.png
62    :align: center
63
64 Select the list of points to create a curve and set the **Precision** value. The curve will pass not far than the precision of these points.
65
66 Clicking the **Reorder points** button will change the order of selected points to minimize the distances between the neighbors.
67
68 **TUI Command**:
69
70 .. py:function:: Sketch_1.addApproximation(points, precision = 0.001, periodic = False, closed = False)
71
72     :param list: points for the curve.
73     :param double: how close the curve should pass according to the points.
74     :param boolean: flag to make the curve periodic.
75     :param boolean: flag to make the curve closed but not periodic.
76     :return: Created B-spline curve.
77
78 Result
79 """"""
80
81 The created B-spline curve appears in the view.
82
83 .. image:: images/curvefitting_approximation_res.png
84            :align: center
85
86 .. centered::
87    Approximated curve (non-closed, periodic and closed)
88
89 **See Also** a sample TUI Script of :ref:`tui_create_approximation` operation.