Box#
[1]:
import sys
import fresnel
scene = fresnel.Scene()
The Box geometry is a convenience class that uses the Cylinder geometry to draw a box. The Box geometry supports triclinic boxes and follows hoomd-blue box conventions. For cubic boxes, only one length is needed.
[2]:
my_box = [5]
[3]:
geometry = fresnel.geometry.Box(scene, my_box)
[4]:
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[4]:
Orthorhombic boxes require an Lx, Ly, and Lz
[5]:
my_box = [5,6,7]
scene = fresnel.Scene()
geometry = fresnel.geometry.Box(scene, my_box)
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[5]:
Triclinic boxes are supported by using 6 terms, Lx, Ly, Lz, xy, xz, yz.
[6]:
my_box = [5,6,7, .2, 0, .9]
scene = fresnel.Scene()
geometry = fresnel.geometry.Box(scene, my_box)
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[6]:
The radius defaults to 0.5
but can be specifed when the box is created
[7]:
my_box = [5,6,7, .2, 0, .9]
scene = fresnel.Scene()
geometry = fresnel.geometry.Box(scene, my_box, box_radius=.1)
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[7]:
Or changed later
[8]:
geometry.box_radius = 1
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[8]:
The box color can also be set on initialization.
[9]:
my_box = [5, 6, 7, 0.2, 0, 0.9]
scene = fresnel.Scene()
geometry = fresnel.geometry.Box(scene, my_box, box_color=[214 / 255, 67 / 255, 9 / 255])
scene.camera = fresnel.camera.Orthographic.fit(scene)
fresnel.preview(scene)
[9]:
Or changed later.
[10]:
geometry.box_color = [0, 51 / 255, 160 / 255]
fresnel.preview(scene)
[10]:
The box size and shape can also be updated.
[11]:
geometry.box = [4, 4, 5, 0.6, 0,0]
fresnel.preview(scene)
[11]: