Открыть боковую панель
nikitronn
sverchok
Коммиты
733e607e
Коммит
733e607e
создал
Июн 13, 2019
по автору
Ilya Portnov
Просмотр файлов
Fix "c"/"s" implementation according to SVG specification.
владелец
576b2a73
Изменения
2
Скрыть пробелы
Построчно
Рядом
nodes/generators_extended/profile_mk3.py
Просмотр файла @
733e607e
...
@@ -391,9 +391,17 @@ class CurveTo(Statement):
...
@@ -391,9 +391,17 @@ class CurveTo(Statement):
knot1
=
interpreter
.
position
knot1
=
interpreter
.
position
handle1
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control1
[
0
],
self
.
control1
[
1
],
variables
)
handle1
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control1
[
0
],
self
.
control1
[
1
],
variables
)
interpreter
.
position
=
handle1
# In Profile mk2, for "c" handle2 was calculated relative to handle1,
# and knot2 was calculated relative to handle2.
# But in SVG specification,
# >> ... *At the end of the command*, the new current point becomes
# >> the final (x,y) coordinate pair used in the polybézier.
# This is also behaivour of browsers.
#interpreter.position = handle1
handle2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control2
[
0
],
self
.
control2
[
1
],
variables
)
handle2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control2
[
0
],
self
.
control2
[
1
],
variables
)
interpreter
.
position
=
handle2
#
interpreter.position = handle2
knot2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
knot2
[
0
],
self
.
knot2
[
1
],
variables
)
knot2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
knot2
[
0
],
self
.
knot2
[
1
],
variables
)
interpreter
.
position
=
knot2
interpreter
.
position
=
knot2
...
@@ -536,12 +544,10 @@ class SmoothCurveTo(Statement):
...
@@ -536,12 +544,10 @@ class SmoothCurveTo(Statement):
dx
,
dy
=
x0
-
prev_knot_x
,
y0
-
prev_knot_y
dx
,
dy
=
x0
-
prev_knot_x
,
y0
-
prev_knot_y
handle1
=
x0
+
dx
,
y0
+
dy
handle1
=
x0
+
dx
,
y0
+
dy
# FIXME: it is not clear for me from SVG specification: for "s",
# I assume that handle2 should be relative to knot1, not to handle1.
# should handle2 be calculated relatively to knot1 or relatively to handle1?
# I assume that it should be relative to knot1.
# interpreter.position = handle1
# interpreter.position = handle1
handle2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control2
[
0
],
self
.
control2
[
1
],
variables
)
handle2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
control2
[
0
],
self
.
control2
[
1
],
variables
)
interpreter
.
position
=
handle2
#
interpreter.position = handle2
knot2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
knot2
[
0
],
self
.
knot2
[
1
],
variables
)
knot2
=
interpreter
.
calc_vertex
(
self
.
is_abs
,
self
.
knot2
[
0
],
self
.
knot2
[
1
],
variables
)
interpreter
.
position
=
knot2
interpreter
.
position
=
knot2
...
...
profile_examples/smooth_curve.txt
Просмотр файла @
733e607e
M 0,0
M 0,0
C 1,1 3,1 4,0 20 0
C 1,1 3,1 4,0 20 0
s 3,-1 1,1 20
s 3,-1 4,0 20
s 3,1 1,-1 20
s 3,1 4,0 20
s 1,-3 -1,-1 20
s 1,-3 0,-4 20
s -3,-1 -4,0 20
s -3,1 -4,0 20
s -3,-1 -4,0 20
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать