Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 161d296

Browse files
committed
31640: fix bezier curves plotting in 3d
1 parent 824f9cc commit 161d296

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/sage/plot/plot3d/shapes2.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,19 @@ def bezier3d(path, **options):
225225
sage: curve = bezier3d(path, thickness=5, color='blue')
226226
sage: curve
227227
Graphics3d Object
228+
229+
TESTS:
230+
231+
Check for :trac:`31640`::
232+
233+
sage: p2d = [[(3,0.0),(3,0.13),(2,0.2),(2,0.3)], [(2.7,0.4),(2.6,0.5),(2.5,0.5)], [(2.3,0.5),(2.2,0.4),(2.1,0.3)]]
234+
sage: bp = bezier_path(p2d)
235+
sage: bp.plot3d()
236+
Graphics3d Object
237+
238+
sage: p3d = p3d = [[(3,0,0),(3,0.1,0),(2.9,0.2,0),(2.8,0.3,0)], [(2.7,0.4,0),(2,0.5,0),(2.5,0.5,0)], [(2.3,0.5,0),(2.2,0.4,0),(2.1,0.3,0)]]
239+
sage: bezier3d(p3d)
240+
Graphics3d Object
228241
"""
229242
from . import parametric_plot3d as P3D
230243
from sage.modules.free_module_element import vector
@@ -247,7 +260,7 @@ def bezier3d(path, **options):
247260
G += P3D.parametric_plot3d(list(B), (0, 1), color=options['color'], aspect_ratio=options['aspect_ratio'], thickness=options['thickness'], opacity=options['opacity'])
248261
else:
249262
G += line3d([p0,curve[0]], color=options['color'], thickness=options['thickness'], opacity=options['opacity'])
250-
p0 = curve[-1]
263+
p0 = vector(curve[-1])
251264
return G
252265

253266
@rename_keyword(alpha='opacity')

0 commit comments

Comments
 (0)