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

Plane rotation over Z-axis not working as expected #900

Open
Niketin opened this issue Feb 9, 2025 · 2 comments
Open

Plane rotation over Z-axis not working as expected #900

Niketin opened this issue Feb 9, 2025 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@Niketin
Copy link

Niketin commented Feb 9, 2025

I stumbled upon this line in the documentation while playing with planes and rotating them:

Since the z axis is always normal the plane, rotating around Z will
always produce a plane that is parallel to this one.

I believe rotation of a plane does not work as described. Rotating plane over Z-axis does not rotate it over its own Z-axis, but over the world's Z-axis. I will demonstrate my observation below.

p1 = Plane.XZ
p2 = p1.rotated((0, 0, 90))
p3 = p2.rotated((0, 0, 90))
p4 = p3.rotated((0, 0, 90))

p2 = p2.move(Location((10, 0, 0)))
p3 = p3.move(Location((20, 0, 0)))
p4 = p4.move(Location((30, 0, 0)))

show(
    location_symbol(p1.location, l=3),
    location_symbol(p2.location, l=3),
    location_symbol(p3.location, l=3),
    location_symbol(p4.location, l=3),
)

In the example, I chose Plane.XZ as the base plane. Then I created copies of it, each rotated by 90 degrees from the previous plane, around the Z-axis. Then, the planes are moved so that they are not on top of each other, for easier visualization.
Image
As can be seen from the picture, The plane is rotated around its Y-axis, which is parallel to the world's Z-axis.

Is it a bug? In case it is not a bug and it works as intended, I have a follow-up question: how can I rotate a plane around its own Z-axis?

@gumyr gumyr added the question Further information is requested label Feb 9, 2025
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Feb 9, 2025
@gumyr
Copy link
Owner

gumyr commented Feb 9, 2025

The rotations are global. You want to set/change the Plane's x_dir.

pln0 = Plane.XY
pln1 = Plane(origin=pln0.origin, x_dir=(0, 1, 0), z_dir=pln0.z_dir)

@Niketin
Copy link
Author

Niketin commented Feb 20, 2025

@gumyr I see. Then the part of the documentation referred above doesn't really make sense to me. The statement seems false in the context of rotating a plane using this method.

@gumyr gumyr added the documentation Improvements or additions to documentation label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants