Открыть боковую панель
nikitronn
sverchok
Коммиты
a5dc101f
Коммит
a5dc101f
создал
Авг 23, 2022
по автору
Ilya Portnov
Просмотр файлов
"NURBS Curve Nodes" node.
владелец
ebe4f681
Изменения
4
Скрыть пробелы
Построчно
Рядом
docs/nodes/curve/curve_index.rst
Просмотр файла @
a5dc101f
...
...
@@ -33,6 +33,7 @@ Curves
length_rebuild
curvature
torsion
nurbs_curve_nodes
deconstruct_curve
curve_frame
curve_frame_on_surface
...
...
docs/nodes/curve/nurbs_curve_nodes.rst
0 → 100644
Просмотр файла @
a5dc101f
NURBS Curve Nodes
=================
Functionality
-------------
This node calculates so-called *node* points (also known as Greville points or
average knot points) of the NURBS curve.
NURBS curve *nodes* (or Greville abscissaes) are defined as:
``t[i] = sum(u[i+j] for j from 1 to p) / p``, where ``u`` is curve's knotvector, and
``p`` is curve's degree.
NURBS curve *node points* (or Greville points) are points at the curve at
parameter values equal to node values.
The number of curve's nodes is equal to the number of curve's control points.
Node points of the curve are positioned on the curve near corresponding control
points. So in many NURBS algorithms, node points are used to define the shape
of NURBS curve, instead of control points.
Inputs
------
This node has the following input:
* **Curve**. The NURBS Curve object to calculate nodes for. This input is mandatory.
Outputs
-------
This node has the following outputs:
* **Points**. The calculated node points on the curve.
* **T**. The calculated node values (values of curve's T parameter corresponding to node points).
Example of Usage
----------------
index.md
Просмотр файла @
a5dc101f
...
...
@@ -68,6 +68,7 @@
SvApproxNurbsCurveMk2Node
SvExInterpolateNurbsCurveNode
SvDeconstructCurveNode
SvNurbsCurveNodesNode
---
SvCurveInsertKnotNode
SvCurveRemoveKnotNode
...
...
nodes/curve/nurbs_curve_nodes.py
0 → 100644
Просмотр файла @
a5dc101f
# This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
import
numpy
as
np
import
bpy
from
bpy.props
import
FloatProperty
,
EnumProperty
,
BoolProperty
,
IntProperty
from
sverchok.node_tree
import
SverchCustomTreeNode
from
sverchok.data_structure
import
(
updateNode
,
zip_long_repeat
,
ensure_nesting_level
,
get_data_nesting_level
)
from
sverchok.utils.curve
import
SvCurve
from
sverchok.utils.curve.nurbs
import
SvNurbsCurve
class
SvNurbsCurveNodesNode
(
bpy
.
types
.
Node
,
SverchCustomTreeNode
):
"""
Triggers: NURBS curve nodes (Greville points)
Tooltip: Display nodes (a.k.a edit points or Greville points) of a NURBS curve
"""
bl_idname
=
'SvNurbsCurveNodesNode'
bl_label
=
'NURBS Curve Nodes'
bl_icon
=
'OUTLINER_OB_EMPTY'
sv_icon
=
'SV_DECONSTRUCT_CURVE'
def
sv_init
(
self
,
context
):
self
.
inputs
.
new
(
'SvCurveSocket'
,
"Curve"
)
self
.
outputs
.
new
(
'SvVerticesSocket'
,
"Points"
)
self
.
outputs
.
new
(
'SvStringsSocket'
,
"T"
)
def
process
(
self
):
if
not
any
(
socket
.
is_linked
for
socket
in
self
.
outputs
):
return
curve_s
=
self
.
inputs
[
'Curve'
].
sv_get
()
curves_level
=
get_data_nesting_level
(
curve_s
,
data_types
=
(
SvCurve
,))
curve_s
=
ensure_nesting_level
(
curve_s
,
2
,
data_types
=
(
SvCurve
,))
points_out
=
[]
t_out
=
[]
for
curves
in
curve_s
:
point_list
=
[]
t_list
=
[]
for
curve
in
curves
:
ts
=
curve
.
calc_greville_ts
()
pts
=
curve
.
evaluate_array
(
ts
)
t_list
.
append
(
ts
.
tolist
())
point_list
.
append
(
pts
.
tolist
())
if
curves_level
==
2
:
points_out
.
append
(
point_list
)
t_out
.
append
(
t_list
)
else
:
points_out
.
extend
(
point_list
)
t_out
.
extend
(
t_list
)
self
.
outputs
[
'Points'
].
sv_set
(
points_out
)
self
.
outputs
[
'T'
].
sv_set
(
t_out
)
def
register
():
bpy
.
utils
.
register_class
(
SvNurbsCurveNodesNode
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
SvNurbsCurveNodesNode
)
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать