aboutsummaryrefslogtreecommitdiff
path: root/src/Vector.ts
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2022-01-03 21:09:23 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2022-01-03 21:09:23 +0000
commit496c63266d02bc9369e3406353b877a8ebbae60a (patch)
tree492af5590ac21a70099e2ac7cb38ca91dce3a694 /src/Vector.ts
parent026a006b410a0132c2cb573edff4352b4333b857 (diff)
downloadjs-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.tar.xz
js-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.zip
Implement refraction
Diffstat (limited to 'src/Vector.ts')
-rw-r--r--src/Vector.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Vector.ts b/src/Vector.ts
index 3cebf6d..2be8e57 100644
--- a/src/Vector.ts
+++ b/src/Vector.ts
@@ -33,4 +33,8 @@ export class Vector {
norm(): number {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
}
+
+ negative(): Vector {
+ return new Vector(-this.x, -this.y, -this.z);
+ }
}