Skip to content

Commit

Permalink
Added Divide Functionality to Vector3 (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisThomp committed Mar 8, 2024
1 parent c7d1f8a commit 3d3a95e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/math/Vector3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ class Vector3 {
}
}

divide(v: number): Vector3;
divide(v: Vector3): Vector3;
divide(v: number | Vector3 ): Vector3 {
if (typeof v === "number") {
return new Vector3(this.x / v, this.y / v, this.z / v);
} else {
return new Vector3(this.x / v.x, this.y / v.y, this.z / v.z);
}
}

cross(v: Vector3): Vector3 {
const x = this.y * v.z - this.z * v.y;
const y = this.z * v.x - this.x * v.z;
Expand Down

0 comments on commit 3d3a95e

Please sign in to comment.