Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 21d80a1

Browse files
author
Onur Rauf Bingol
committedFeb 17, 2019
Update Basics page with knot vector generator
1 parent 2fafe6f commit 21d80a1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎docs/basics.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,29 @@ The following code snippet generates a B-Spline (non-rational) curve and convert
217217
# BSpline to NURBS
218218
crv_rat = convert.bspline_to_nurbs(crv)
219219
220+
Using knot vector generator
221+
---------------------------
222+
223+
Knot vector generator is located in the :doc:`knotvector <module_knotvector>` module.
224+
225+
.. code-block:: python
226+
:linenos:
227+
228+
from geomdl import BSpline
229+
from geomdl import knotvector
230+
231+
# Create the curve instance
232+
crv = BSpline.Curve()
233+
234+
# Set degree
235+
crv.degree = 2
236+
237+
# Set control points
238+
crv.ctrlpts = [[1, 0, 0], [1, 1, 0], [0, 1, 0]]
239+
240+
# Generate a uniform knot vector
241+
crv.knotvector = knotvector.generate(crv.degree, crv.ctrlpts_size)
242+
220243
Please refer to the :doc:`Examples Repository <examples_repo>` for more curve examples.
221244

222245
How to create a surface & a volume

0 commit comments

Comments
 (0)
Please sign in to comment.