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

Cylinder direction not unique. #550

Closed
Sassafrass6 opened this issue Mar 3, 2022 · 2 comments
Closed

Cylinder direction not unique. #550

Sassafrass6 opened this issue Mar 3, 2022 · 2 comments
Labels
type:Bug Fix Something isn't working

Comments

@Sassafrass6
Copy link
Contributor

Description

Directions passed to the cylinder actor do not refer to the unique axis of the cylinder.

Way to reproduce

from fury import actor,window
import numpy as np

scene = window.Scene()

centers = np.array([[-2,0,0],[0,0,0],[2,0,0]])
dirs = np.array([[1,0,0],[0,1,0],[0,0,1]])

arrows = actor.arrow(centers, dirs, dirs)
scene.add(arrows)

centers += np.array([0,1,0])
cyls = actor.cylinder(centers, dirs, dirs)
scene.add(cyls)

showm = window.ShowManager(scene)
showm.initialize()
showm.start()

@skoudoro
Copy link
Contributor

skoudoro commented Mar 3, 2022

Thank you for the feedback @Sassafrass6. we will look into it. If you have a fix, feel free to contribute!

Related to #531

@skoudoro skoudoro added the type:Bug Fix Something isn't working label Mar 3, 2022
@Sassafrass6
Copy link
Contributor Author

I have solved the issue.
The problem arises because the orientation of vtkCylinderSource is along global y.
Ive introduced another argument into repeat_sources (in utils.py), called orientation, which can be set to a rotation matrix. If this new argument is set to something besides None, the matrix is applied as a transformation to the glyph before mapping it to an actor. This way, any time a vtkSource is not aligned with the X axis, it can be transformed (arbitrarily with the new orientation argument) before creating any actors.
Then, I add this orientation argument to the cylinder method in actors.py.

How would you like me to contribute the fix to the repository?

skoudoro added a commit that referenced this issue Apr 4, 2022
Fixed #550 : Added necessary allignment between glyph creation and ac…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Fix Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants