Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate Transformation #39

Closed
threeal opened this issue May 12, 2021 · 1 comment
Closed

Separate Transformation #39

threeal opened this issue May 12, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@threeal
Copy link
Member

threeal commented May 12, 2021

To make the transformation process simpler, especially when we need to do rotation transform only. Instead of doing this:

Transform2 transform();
transform.set_rotation(90.0);

auto transformed_point = transform * point;

It's better to write that like this:

auto transformed_point = Rotation2(90.0) * point;

In case we need to do all the transformation, it could also be more simpler:

auto transformed_point = Translation2(-5.0, 0.0) * Rotation2(90.0) * point;

And the good news is that we could specify the order of transformation. That's why i suggest it's better to separate the transformation into each of it's components (e.g. Transform2 will be separated into Rotation2, Scale2 and Translation2).

@threeal threeal added the enhancement New feature or request label May 12, 2021
@threeal threeal added this to the First Major Release milestone May 12, 2021
@threeal
Copy link
Member Author

threeal commented Jul 26, 2021

Closed by #46.

In the end, transform point directly from it's member function is more convenient than using external transform object.

Rather than:

auto transformed_point = Translation2(-5.0, 0.0) * Rotation2(90.0) * point;

It's better to use:

auto transformed_point = point.rotate(90.0).translate({-5.0, 0.0});

@threeal threeal closed this as completed Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant