Skip to content

Commit

Permalink
feat(engine): added getMultipliedVector function
Browse files Browse the repository at this point in the history
  • Loading branch information
wialy committed Mar 6, 2024
1 parent f8e4762 commit b34f7b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Vector } from '../../types/entities';

export const getMultipliedVector = ({
multiplier,
vector,
}: {
vector: Vector;
multiplier: number;
}): Vector => {
const result = {
x: vector.x * multiplier,
y: vector.y * multiplier,
};

return {
x: Object.is(result.x, -0) ? 0 : result.x,
y: Object.is(result.y, -0) ? 0 : result.y,
};
};
1 change: 1 addition & 0 deletions src/features/engine/utils/get-multiplied-vector/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './get-multiplied-vector';

0 comments on commit b34f7b7

Please sign in to comment.