Commit d4c24e61 by Oriol Gómez

fuck you

parent c5799b70
'use strict';
function distance3D(x1, y1, z1, x2, y2, z2) {
export function distance3D(x1, y1, z1, x2, y2, z2) {
return Math.sqrt((x2-x1)*(x2-x1) +
(y2-y1)*(y2-y1) +
(z2-z1)*(z2-z1));
}
function distance(jx, jy, kx, ky) {
export function distance(jx, jy, kx, ky) {
//return Math.hypot(jx-kx, jy-ky)
return Math.sqrt(((jx - kx) * (jx - kx)) + ((jy - ky)) * (jy - ky))
}
function calculateAngle(x1, y1, x2, y2) {
export function calculateAngle(x1, y1, x2, y2) {
var angle = Math.atan2((y2-y1), (x2-x1));
angle = (angle >= 0) ? 0 : (2*Math.PI) + angle;
return angle;
// return Math.atan2((y2 - y1),(x2 - x1));
}
function isCollide3D(a, b)
export function isCollide3D(a, b)
{
return(a.x <= (b.x+b.width) && (a.x+a.width) >= b.x)&&(a.y <= (b.y+b.height) && (a.y+a.height) >= b.y)&&(a.z <= (b.z+b.depth) && (a.z+a.depth) >= b.z);
}
function randomInt(min, max) {
export function randomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function getRandomArbitrary(min, max) {
export function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
export {distance3D,distance,calculateAngle,isCollide3D,randomInt,getRandomArbitrary}
\ No newline at end of file
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment