This repository was archived by the owner on Feb 1, 2023. It is now read-only.
Commit b570ac3
Release Manager
Trac #31640: 2d Bezier path does not plot in 3d
From https://ask.sagemath.org/question/56590/problem-with-plotting-a-3d-
bezier-curve/
{{{
sage: p2d = [[(3.0,0.0),(3.0,0.13),(2.94,0.25),(2.8,0.35)],
[(2.7,0.44),(2.6,0.5),(2.5,0.5)], [(2.36,0.5),(2.24,0.44),(2.14,0.35)],
[(2.05,0.25),(2.0,0.13),(2.0,6.1e-17)]]
sage: bp=bezier_path(p2d)
sage: bp.plot3d()
Traceback (most recent call last):
/opt/sage/local/lib/python3.9/site-packages/sage/symbolic/expression.pyx
in sage.symbolic.expression.Expression._integer_
(build/cythonized/sage/symbolic/expression.cpp:8801)()
1298 try:
-> 1299 n = self.pyobject()
1300 except TypeError:
/opt/sage/local/lib/python3.9/site-packages/sage/symbolic/expression.pyx
in sage.symbolic.expression.Expression.pyobject
(build/cythonized/sage/symbolic/expression.cpp:6136)()
586 if not is_a_numeric(self._gobj):
--> 587 raise TypeError("self must be a numeric expression")
588 return py_object_from_numeric(self._gobj)
TypeError: self must be a numeric expression
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call
last)
<ipython-input-6-37e325e9051f> in <module>
----> 1 bp.plot3d()
/opt/sage/local/lib/python3.9/site-packages/sage/plot/graphics.py in
plot3d(self, z, **kwds)
1279 """
1280 from sage.plot.plot3d.base import Graphics3dGroup
-> 1281 g = Graphics3dGroup([g.plot3d(**kwds) for g in
self._objects])
1282 if z:
1283 g = g.translate(0,0,z)
/opt/sage/local/lib/python3.9/site-packages/sage/plot/graphics.py in
<listcomp>(.0)
1279 """
1280 from sage.plot.plot3d.base import Graphics3dGroup
-> 1281 g = Graphics3dGroup([g.plot3d(**kwds) for g in
self._objects])
1282 if z:
1283 g = g.translate(0,0,z)
/opt/sage/local/lib/python3.9/site-packages/sage/plot/bezier_path.py in
plot3d(self, z, **kwds)
168 options = self._plot3d_options()
169 options.update(kwds)
--> 170 return bezier3d([[(x,y,0) for x,y in self.path[i]] for i
in range(len(self.path))], **options)
171
172 def _repr_(self):
/opt/sage/local/lib/python3.9/site-packages/sage/misc/decorators.py in
wrapper(*args, **kwds)
649 kwds[new_name] = kwds[old_name]
650 del kwds[old_name]
--> 651 return func(*args, **kwds)
652
653 return wrapper
/opt/sage/local/lib/python3.9/site-packages/sage/misc/decorators.py in
wrapper(*args, **kwds)
489 options['__original_opts'] = kwds
490 options.update(kwds)
--> 491 return func(*args, **options)
492
493 #Add the options specified by @options to the signature
of the wrapped
/opt/sage/local/lib/python3.9/site-packages/sage/plot/plot3d/shapes2.py
in bezier3d(path, **options)
244 p2 = vector(curve[-2])
245 p3 = vector(curve[-1])
--> 246 B =
(1-t)**3*p0+3*t*(1-t)**2*p1+3*t**2*(1-t)*p2+t**3*p3
247 G += P3D.parametric_plot3d(list(B), (0, 1),
color=options['color'], aspect_ratio=options['aspect_ratio'],
thickness=options['thickness'], opacity=options['opacity'])
248 else:
/opt/sage/local/lib/python3.9/site-packages/sage/symbolic/expression.pyx
in sage.symbolic.expression.Expression.__index__
(build/cythonized/sage/symbolic/expression.cpp:34734)()
5985 [0, 1, 2, 3, 4]
5986 """
-> 5987 return int(self._integer_())
5988
5989 def iterator(self):
/opt/sage/local/lib/python3.9/site-packages/sage/symbolic/expression.pyx
in sage.symbolic.expression.Expression._integer_
(build/cythonized/sage/symbolic/expression.cpp:8850)()
1299 n = self.pyobject()
1300 except TypeError:
-> 1301 raise TypeError("unable to convert %r to an integer"
% self)
1302 if isinstance(n, sage.rings.integer.Integer):
1303 return n
TypeError: unable to convert -(t - 1)^3 to an integer
}}}
URL: https://trac.sagemath.org/31640
Reported by: vdelecroix
Ticket author(s): Vincent Delecroix
Reviewer(s): Frédéric ChapotonFile tree
3 files changed
+18
-5
lines changed- build/pkgs/configure
- src/sage/plot/plot3d
3 files changed
+18
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
228 | 241 | | |
229 | 242 | | |
230 | 243 | | |
| |||
247 | 260 | | |
248 | 261 | | |
249 | 262 | | |
250 | | - | |
| 263 | + | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
0 commit comments