CoCalc Public Filessupport / 2017-07-22-114307-3d-box.sagews
Author: William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb
pts = [[100,110,115],[113,111,117],[120,135,110],[129,114,118]]
p=Polyhedron(vertices=pts)
sum(p.plot().all[1:])

3D rendering not yet implemented

a,b = p.bounding_box()
print(a,b)
p.show()
(point3d(a)+point3d(b)).show()
sum([point3d(v) for v in pts]).show()

((100, 110, 110), (129, 135, 118))
3D rendering not yet implemented
3D rendering not yet implemented
3D rendering not yet implemented


s = p.plot()
type(s)

<class 'sage.plot.plot3d.base.Graphics3dGroup'>

s.bounding_box()


((0.0, 0.0, 0.0), (129.0, 135.0, 118.0))


s.bounding_box??

   File: /projects/sage/sage-7.6/src/sage/plot/plot3d/base.pyx
Source:
def bounding_box(self):
"""
Box that contains the bounding boxes of
all the objects that make up self.

EXAMPLES::

sage: A = sphere((0,0,0), 5)
sage: B = sphere((1, 5, 10), 1)
sage: A.bounding_box()
((-5.0, -5.0, -5.0), (5.0, 5.0, 5.0))
sage: B.bounding_box()
((0.0, 4.0, 9.0), (2.0, 6.0, 11.0))
sage: (A+B).bounding_box()
((-5.0, -5.0, -5.0), (5.0, 6.0, 11.0))
sage: (A+B).show(aspect_ratio=1, frame=True)

sage: sage.plot.plot3d.base.Graphics3dGroup([]).bounding_box()
((0.0, 0.0, 0.0), (0.0, 0.0, 0.0))
"""
if len(self.all) == 0:
return Graphics3d.bounding_box(self)
v = [obj.bounding_box() for obj in self.all]
return min3([a[0] for a in v]), max3([a[1] for a in v])


for x in s.all:
print x.bounding_box()

((0.0, 0.0, 0.0), (0.0, 0.0, 0.0)) ((100.0, 110.0, 110.0), (129.0, 135.0, 118.0)) ((100.0, 110.0, 110.0), (129.0, 135.0, 118.0)) ((100.0, 110.0, 110.0), (129.0, 135.0, 118.0))
sum(s.all[1:])

3D rendering not yet implemented
B = 5; s.xmax(-B); s.xmin(B); s.ymax(-B); s.ymin(B); s.zmax(-B); s.zmax(B)
s


Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-7.6/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> AttributeError: 'Graphics3dGroup' object has no attribute 'xmax'