fury-gl / fury

FURY - Free Unified Rendering in pYthon.
https://fury.gl
Other
246 stars 182 forks source link

The rotation done by repeat_primitive function is not working as it should. #554

Closed m-agour closed 2 years ago

m-agour commented 2 years ago

Description

The rotation done by repeat_primitive function is not working as it should be. And the rotated actor doesn't fit to the direction vector.

Way to reproduce

I tried to add three arrow actors returned by repeat_primitive pointing at the three main axes with colors (r, g, b -> x, y, z), and they all should've been perpendicular, but they weren't (the same issue happens for the frustum actor).

Code example

import numpy as np  
from fury import window, actor  

scene = window.Scene()  
centers = np.zeros([3, 3])  
dirs = np.identity(3)  
colors = np.identity(3)  
scales=np.array([1.1, 1.2, 1.3])

actor1 = actor.arrow(centers, dirs, colors=colors, scales=scales)  
scene.add(actor1)  

window.show(scene, size=(600, 600), reset_camera=False, title='Using repeat_source')

image

comparing repeat_primitive (large arrows) to repeat_source (small arrows) using the code below:

import numpy as np  
from fury import window, actor  

scene = window.Scene()  

centers = np.zeros([3, 3])  
dirs = np.identity(3)  
colors = np.identity(3)  
scales = np.array([2.1, 2.3, 2.5])  

rsactor = actor.arrow(centers, dirs, colors=colors, tip_radius=0.17, repeat_primitive=False)  
rpactor = actor.arrow(centers, dirs, colors=colors, scales=scales)  

scene.add(rsactor)  
scene.add(rpactor)  

window.show(scene, size=(600, 600), reset_camera=False, title='Comparing')

image

I think there is something wrong with the rotation matrix inside repeat_primitive function.

Operating system and versions

{'fury_version': '0.post3172.dev0+gdadbb8e', 'pkg_path': 'A:\\cont\\fury\\fury', 'commit_hash': 'dadbb8e66938e964c25d01e6bed427e1fe7efc0c', 'sys_version': '3.8.9 (tags/v3.8.9:a743f81, 
Apr  6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)]', 'sys_executable': 'C:\\Users\\msi\\AppData\\Local\\Programs\\Python\\Python38\\python.exe', 'sys_platform': 'win32', 'numpy_version': '1.22.3', 'scipy_version': '1.8.0', 'vtk_version': '9.1.0', 'matplotlib_version': '3.5.1'}
skoudoro commented 2 years ago

closed by #555