fix: angle math

This commit is contained in:
cha0s 2019-11-09 16:44:21 -06:00
parent b77cd645f0
commit ba601af505

View File

@ -13,11 +13,11 @@ export function translate (vertice, origin, rotation = 0, scale = 1) {
}
// Rotate.
const difference = Vector.sub(vertice, origin);
rotation += Vector.angle(difference);
rotation += Vector.toAngle(difference);
const magnitude = Vector.magnitude(vertice, origin);
vertice = Vector.add(
origin,
Vector.scale([Math.cos(rotation), Math.sin(rotation)], magnitude)
Vector.scale(Vector.fromAngle(rotation), magnitude)
);
// Scale.
vertice = Vector.scale(vertice, scale);