Skip to content

Bug: rotate_around_point function in math.py returns incorrect results due to wrong translation #2753

Description

@Raahi-18

The rotate_around_point function in math.py has a bug on line 394 where it adds the rotated displacement vector to the target point instead of the source point (rotation center).

The current code is the following:
return target[0] + dx, target[1] + dy

Example of the bug:
Rotating point (5, 0) around (3, 0) by 90° currently returns (5, 2) but should return (3, 2).

This is a simple one line fix just have to update return statement to:
return source[0] + dx, source[1] + dy

I can make a PR for the update.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions