Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Advanced coordinate rotation: possible typo? #4

@edwardball

Description

@edwardball

Hi Billy, great book.

On page 228, there's a couple of equations

x1 = (x-centerX) * cos(rotation) - (y-centerY) * sin(rotation)
y1 = (y-centerY) * cos(rotation) + (x-centerX) * sin(rotation)

I tried coding these up and it certainly rotates the point, but it is offset by (-centerX, -centerY)

Should the equations be these?

x1 = centerX + [(x-centerX) * cos(rotation) - (y-centerY) * sin(rotation)]
y1 = centerY + [(y-centerY) * cos(rotation) + (x-centerX) * sin(rotation)]

Cheers,

Ed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions