-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathexample2.py
More file actions
29 lines (19 loc) · 960 Bytes
/
example2.py
File metadata and controls
29 lines (19 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import env # noqa: F401
TITLE = "Stacking Cuboids"
DESCRIPTION = """ It is possible to stack multiple cuboids together, which will manage the interface materials.
To be stackable in a particular axis, the cuboids must have the same size in that axis."""
def exampleCode():
from pytissueoptics.scene import Cuboid, Vector, get3DViewer
cuboid1 = Cuboid(1, 1, 1, position=Vector(2, 0, 0), label="1")
cuboid2 = Cuboid(2, 1, 1, position=Vector(0, 2, 0), label="2")
cuboid3 = Cuboid(3, 1, 1, position=Vector(0, 0, 2), label="3")
viewer = get3DViewer()
viewer.add(cuboid1, cuboid2, cuboid3, representation="wireframe", lineWidth=5)
viewer.show()
cuboidStack = cuboid1.stack(cuboid2, onSurface="right")
cuboidStack = cuboidStack.stack(cuboid3, onSurface="top")
viewer = get3DViewer()
viewer.add(cuboidStack, representation="wireframe", lineWidth=5)
viewer.show()
if __name__ == "__main__":
exampleCode()