17 lines
364 B
JavaScript
17 lines
364 B
JavaScript
/**
|
|
* Compute the euclidean distance between two points
|
|
* @param {Point} p1
|
|
* @param {Point} p2
|
|
*/
|
|
export function computeDist(p1, p2) {
|
|
return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
|
|
}
|
|
|
|
/**
|
|
* Return the current time in ms since 1970
|
|
* @returns {number}
|
|
*/
|
|
export function getCurrentTimeMs() {
|
|
return new Date().getTime();
|
|
}
|