← 返回首页
Rotation by BalzaniEdoardo · Pull Request #439 · fastplotlib/fastplotlib · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Rotation#439

Merged
kushalkolar merged 8 commits into
fastplotlib:mainfrom
BalzaniEdoardo:rotation
Mar 27, 2024
Merged

Rotation#439
kushalkolar merged 8 commits into
fastplotlib:mainfrom
BalzaniEdoardo:rotation

Conversation

Copy link
Copy Markdown
Collaborator

Added a rotation property and a setter to Graphic and a method to set a rotation of a given angle over one of the axis, with respect to the world.

closes #427

Copy link
Copy Markdown
Member

good to go after a test :D

Copy link
Copy Markdown
Collaborator Author

good to go after a test :D

Nice!!

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Collaborator

A general remark about transformations for the graphics object:

I think world_object.local makes more sense that .world. In that case it represents the rotation with respect to the parent. When the graphics are flat, its the same thing (possibly more efficient). And when there is a scene graph (graphics being children of other graphics) in the majority of cases you want to transform with respect to the parent.

Copy link
Copy Markdown
Member

Thanks! If all WorldObjects in a subplot exist within the same scene, then .local and .world have the same effect right? Is there a scientific visualization usecase where you might want to differentially use .local and .world?

almarklein commented Mar 22, 2024
edited
Loading

Copy link
Copy Markdown
Collaborator

If all WorldObjects in a subplot exist within the same scene, then .local and .world have the same effect right?

Yes.

Is there a scientific visualization usecase where you might want to differentially use .local and .world?

The classic example is rendering a robot arm, consisting of several segments, each a child of the previous. If you rotate an element, all the child elements rotate along.

In this scenario, using .local specifies the rotation with respect to the parent, while using .world applies a rotation relative to the word. The first is more common. Many scenegraphs don't even support the latter. But .world can also be convenient, also e.g. to set rotations with .local and then checking positions/rotations in .world.

So practically: I'd recommend using .local everywhere now. And maybe at a later time, if/when fpl supports child graphics, add support for .world transforms.

BalzaniEdoardo requested a review from clewis7 as a code owner March 27, 2024 22:48
Comment thread fastplotlib/graphics/_base.py Outdated Show resolved Hide resolved
kushalkolar previously approved these changes Mar 27, 2024
kushalkolar merged commit 97168ff into fastplotlib:main Mar 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

method for rotating graphics

3 participants

Footer

© 2026 GitHub, Inc.