Skip to content

Commit

Permalink
Merge pull request #57 from kateter-platform/1.0.5
Browse files Browse the repository at this point in the history
Add getNormalized function to vector
  • Loading branch information
jonasdeluna authored Sep 26, 2023
2 parents aec570c + 3ba3e01 commit f93bb0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Components/Vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ class Vector extends Line {
return toVector2(this.vector).y;
}

public getNormalizedX(): number {
return toVector2(this.vector).normalize().x;
}

public getNormalizedY(): number {
return toVector2(this.vector).normalize().y;
}

update(camera: OrthographicCamera) {
this.end = this.calculateEndPoint(this.start, toVector2(this.vector));
this.updateGeometry(this.start, this.end, this.arrowhead, camera);
Expand Down

0 comments on commit f93bb0d

Please sign in to comment.