fix: angle math
This commit is contained in:
parent
b77cd645f0
commit
ba601af505
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user