# Revision history [back]

This looks like a bug and I opened the ticket #31640 to track the issue. Thanks for your report!

This looks like a bug and I opened the ticket #31640 to track the issue. Thanks for your report!

The issue turns out to be a missing vector conversion in the code. I posted a fix and should hopefully make it for a later release.

This looks like a bug and I opened the ticket #31640 to track the issue. Thanks for your report!

The issue turns out to be a missing vector conversion in the code. I posted a fix and should hopefully make it for a later release.

As a work around you can use the following function (that contains the fix I provided in the ticket)

def bezier3d(path, **options):
from . import parametric_plot3d as P3D
from sage.modules.free_module_element import vector
from sage.symbolic.ring import SR

p0 = vector(path[-1])
t = SR.var('t')
if len(path) > 2:
B = (1-t)**3*vector(path)+3*t*(1-t)**2*vector(path)+3*t**2*(1-t)*vector(path[-2])+t**3*p0
G = P3D.parametric_plot3d(list(B), (0, 1), color=options['color'], aspect_ratio=options['aspect_ratio'], thickness=options['thickness'], opacity=options['opacity'])
else:
G = line3d([path, p0], color=options['color'], thickness=options['thickness'], opacity=options['opacity'])

for curve in path[1:]:
if len(curve) > 1:
p1 = vector(curve)
p2 = vector(curve[-2])
p3 = vector(curve[-1])
B = (1-t)**3*p0+3*t*(1-t)**2*p1+3*t**2*(1-t)*p2+t**3*p3
G += P3D.parametric_plot3d(list(B), (0, 1), color=options['color'], aspect_ratio=options['aspect_ratio'],    thickness=options['thickness'], opacity=options['opacity'])
else:
G += line3d([p0,curve], color=options['color'], thickness=options['thickness'], opacity=options['opacity'])
p0 = vector(curve[-1])   # this was the wrong line!
return G


This looks like a bug and I opened the ticket #31640 to track the issue. Thanks for your report!

The issue turns out to be a missing vector conversion in the code. I posted a fix and should hopefully make it for a later release.

As a work around you can use the following function (that contains the fix I provided in the ticket)

def bezier3d(path, **options):
from . import parametric_plot3d as P3D
from sage.modules.free_module_element import vector
from sage.symbolic.ring import SR

p0 = vector(path[-1])
t = SR.var('t')
if len(path) > 2:
B = (1-t)**3*vector(path)+3*t*(1-t)**2*vector(path)+3*t**2*(1-t)*vector(path[-2])+t**3*p0
G = P3D.parametric_plot3d(list(B), (0, 1), color=options['color'], aspect_ratio=options['aspect_ratio'], thickness=options['thickness'], opacity=options['opacity'])
**options)
else:
G = line3d([path, p0], color=options['color'], thickness=options['thickness'], opacity=options['opacity'])
**options)

for curve in path[1:]:
if len(curve) > 1:
p1 = vector(curve)
p2 = vector(curve[-2])
p3 = vector(curve[-1])
B = (1-t)**3*p0+3*t*(1-t)**2*p1+3*t**2*(1-t)*p2+t**3*p3
G += P3D.parametric_plot3d(list(B), (0, 1), color=options['color'], aspect_ratio=options['aspect_ratio'],    thickness=options['thickness'], opacity=options['opacity'])
**options)
else:
G += line3d([p0,curve], color=options['color'], thickness=options['thickness'], opacity=options['opacity'])
**options)
p0 = vector(curve[-1])   # this was the wrong line!
return G