Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RotateVec2()

Helper for rotating a Vec2.

Used in generic Construct() and Draw() to rotate bones and pivots.

function RotateVec2(point: Vec2, rot: float): Vec2 {
    return Vec2 {
        x: point.x * rot.cos() - point.y * rot.sin(),
        y: point.x * rot.sin() + point.y * rot.cos(),
    }
}