diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-03 21:09:23 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-03 21:09:23 +0000 |
| commit | 496c63266d02bc9369e3406353b877a8ebbae60a (patch) | |
| tree | 492af5590ac21a70099e2ac7cb38ca91dce3a694 /src/Vector.ts | |
| parent | 026a006b410a0132c2cb573edff4352b4333b857 (diff) | |
| download | js-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.tar.xz js-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.zip | |
Implement refraction
Diffstat (limited to 'src/Vector.ts')
| -rw-r--r-- | src/Vector.ts | 4 |
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); + } } |