summaryrefslogtreecommitdiffstats
path: root/libdimension-python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension-python/tests')
-rwxr-xr-xlibdimension-python/tests/demo.py16
-rwxr-xr-xlibdimension-python/tests/geometry.py4
2 files changed, 17 insertions, 3 deletions
diff --git a/libdimension-python/tests/demo.py b/libdimension-python/tests/demo.py
index 187f4ef..982fa60 100755
--- a/libdimension-python/tests/demo.py
+++ b/libdimension-python/tests/demo.py
@@ -35,4 +35,18 @@ except OSError as e:
else:
raise
-scene = Scene(canvas = canvas)
+camera = PerspectiveCamera(location = (0, 0.25, -4),
+ look_at = Zero)
+camera.transform(rotate(53*Y))
+
+objects = []
+
+sphere = Sphere(radius = 1, center = Zero)
+objects.append(sphere)
+
+scene = Scene(canvas = canvas,
+ camera = camera,
+ objects = objects)
+scene.raytrace()
+
+canvas.writePNG('demo.png')
diff --git a/libdimension-python/tests/geometry.py b/libdimension-python/tests/geometry.py
index 9c79ef5..0c53ad6 100755
--- a/libdimension-python/tests/geometry.py
+++ b/libdimension-python/tests/geometry.py
@@ -63,12 +63,12 @@ assert str(m) == '\n' \
'[9.0\t10.0\t11.0\t12.0]\n' \
'[0.0\t0.0\t0.0\t1.0]', str(m)
-s = scale(1, 2, 3)
+s = scale(Vector(1, 2, 3))
assert s == Matrix(1, 0, 0, 0,
0, 2, 0, 0,
0, 0, 3, 0), s
-t = translate(x = 1, y = 2, z = 3)
+t = translate((1, 2, 3))
assert t == Matrix(1, 0, 0, 1,
0, 1, 0, 2,
0, 0, 1, 3), t