Skip to content

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

@Raahi-18

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.

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