aboutsummaryrefslogtreecommitdiff
path: root/camera.go
diff options
context:
space:
mode:
Diffstat (limited to 'camera.go')
-rw-r--r--camera.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/camera.go b/camera.go
new file mode 100644
index 0000000..6575390
--- /dev/null
+++ b/camera.go
@@ -0,0 +1,17 @@
+package main
+
+type Camera struct {
+ lower_left_corner Vec3D
+ origin, horizontal, vertical Vec3D
+}
+
+func (camera Camera) GetRay(u float64, v float64) Ray {
+ return Ray{
+ camera.origin,
+ AddVec3D(AddVec3D(
+ camera.lower_left_corner,
+ ScalarProduct(u, camera.horizontal)),
+ ScalarProduct(v, camera.vertical),
+ ),
+ }
+}