Continuously traveling trains
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import * as PIXI from 'pixi.js';
|
||||
|
||||
const EPSILON = 1.0;
|
||||
|
||||
export const randomInt = (min: number, max: number): number => (
|
||||
// inclusive of min and max
|
||||
Math.floor(Math.random() * (max - (min + 1))) + min
|
||||
@@ -25,6 +27,11 @@ export const pointsEqual = (pointA: PIXI.Point, pointB: PIXI.Point): boolean =>
|
||||
(pointA.x === pointB.x && pointA.y === pointB.y)
|
||||
);
|
||||
|
||||
export const pointsAlmostEqual = (pointA: PIXI.Point, pointB: PIXI.Point): boolean => (
|
||||
Math.abs(pointA.x - pointB.x) < EPSILON &&
|
||||
Math.abs(pointA.y - pointB.y) < EPSILON
|
||||
);
|
||||
|
||||
export const distance = (pointA: PIXI.Point, pointB: PIXI.Point): number => {
|
||||
const distX = pointA.x - pointB.x;
|
||||
const distY = pointA.y - pointB.y;
|
||||
|
||||
Reference in New Issue
Block a user