Открыть боковую панель
nikitronn
sverchok
Коммиты
1e660f6f
Коммит
1e660f6f
создал
Сен 13, 2022
по автору
Ilya Portnov
Просмотр файлов
"Sphere (Surface)" node: add NURBS option.
владелец
21376efa
Изменения
2
Скрыть пробелы
Построчно
Рядом
nodes/surface/sphere.py
Просмотр файла @
1e660f6f
...
...
@@ -7,7 +7,8 @@ from bpy.props import FloatProperty, EnumProperty
from
sverchok.node_tree
import
SverchCustomTreeNode
from
sverchok.data_structure
import
updateNode
,
zip_long_repeat
,
ensure_nesting_level
from
sverchok.utils.surface
import
SvLambertSphere
,
SvEquirectSphere
,
SvGallSphere
,
SvDefaultSphere
from
sverchok.utils.surface.sphere
import
SvLambertSphere
,
SvEquirectSphere
,
SvGallSphere
,
SvDefaultSphere
from
sverchok.utils.surface.algorithms
import
build_nurbs_sphere
class
SvSphereNode
(
bpy
.
types
.
Node
,
SverchCustomTreeNode
):
"""
...
...
@@ -22,7 +23,8 @@ class SvSphereNode(bpy.types.Node, SverchCustomTreeNode):
(
'DEFAULT'
,
"Default"
,
"Based on spherical coordinates"
,
0
),
(
'EQUIRECT'
,
"Equirectangular"
,
"Equirectangular (geographic) projection"
,
1
),
(
'LAMBERT'
,
"Lambert"
,
"Lambert cylindrical equal-area projection"
,
2
),
(
'GALL'
,
"Gall Stereographic"
,
"Gall stereographic projection"
,
3
)
(
'GALL'
,
"Gall Stereographic"
,
"Gall stereographic projection"
,
3
),
(
'NURBS'
,
"NURBS Sphere"
,
"NURBS Sphere"
,
4
)
]
def
update_sockets
(
self
,
context
):
...
...
@@ -79,8 +81,12 @@ class SvSphereNode(bpy.types.Node, SverchCustomTreeNode):
surface
=
SvEquirectSphere
(
np
.
array
(
center
),
radius
,
theta1
)
elif
self
.
projection
==
'LAMBERT'
:
surface
=
SvLambertSphere
(
np
.
array
(
center
),
radius
)
el
se
:
el
if
self
.
projection
==
'GALL'
:
surface
=
SvGallSphere
(
np
.
array
(
center
),
radius
)
elif
self
.
projection
==
'NURBS'
:
surface
=
build_nurbs_sphere
(
np
.
array
(
center
),
radius
)
else
:
raise
Exception
(
"Unsupported projection type"
)
surfaces_out
.
append
(
surface
)
self
.
outputs
[
'Surface'
].
sv_set
(
surfaces_out
)
...
...
utils/surface/algorithms.py
Просмотр файла @
1e660f6f
...
...
@@ -1376,3 +1376,13 @@ def remove_excessive_knots(surface, direction, tolerance=1e-6):
return
surface
def
build_nurbs_sphere
(
center
,
radius
):
vectorx
=
np
.
array
([
0.0
,
0.0
,
radius
])
axis
=
np
.
array
([
0.0
,
0.0
,
1.0
])
normal
=
np
.
array
([
1.0
,
0.0
,
0.0
])
matrix
=
SvCircle
.
calc_matrix
(
normal
,
vectorx
)
matrix
=
Matrix
.
Translation
(
center
)
@
Matrix
(
matrix
).
to_4x4
()
arc
=
SvCircle
(
matrix
=
matrix
,
radius
=
radius
,
normal
=
normal
,
vectorx
=
vectorx
)
arc
.
u_bounds
=
(
0.0
,
pi
)
return
nurbs_revolution_surface
(
arc
.
to_nurbs
(),
center
,
axis
,
0
,
2
*
pi
,
global_origin
=
True
)
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать