Skip to content
Snippets Groups Projects
Commit 5db0a620 authored by Luise Odenthal's avatar Luise Odenthal
Browse files

changed renderer

parent a799f3c8
No related branches found
No related tags found
No related merge requests found
...@@ -285,24 +285,56 @@ class BlenderRender(): ...@@ -285,24 +285,56 @@ class BlenderRender():
"""assign the position and the orientation of the camera. """assign the position and the orientation of the camera.
:param posorient: is a 1x6 vector containing: :param posorient: is a 1x6 vector containing:
x,y,z, angle_1, angle_2, angle_3, *in case of euler angeles the index should be
['location']['x']
['location']['y']
['location']['z']
[convention][alpha_0]
[convention][alpha_1]
[convention][alpha_2]
**where convention can be:
sxyz, sxzy, syxz, syzx, szyx, szxy
*in case of quaternions the index should be
['location']['x']
['location']['y']
['location']['z']
[convention]['q_0']
[convention]['q_1']
[convention]['q_2']
[convention]['q_3']
**where convention can be:
quaternion
here the angles are euler rotation around the axis here the angles are euler rotation around the axis
specified by scene.camera.rotation_mode specified by scene.camera.rotation_mode
:type posorient: 1x6 double array :type posorient: pandas Series with multi-index
""" """
print(posorient) if isinstance(posorient, pd.Series):
if (isinstance(posorient, np.ndarray) or # set roation mode
isinstance(posorient, list)): index = posorient.index
convention = index.get_level_values(0)[-1]
if len(posorient) != 6: if convention == 'sxyz':
raise Exception('posorient should be a 1x6 double array') self.camera_rotation_mode = 'XYZ'
self.camera.location = posorient[:3] elif convention == 'syzx':
self.camera.rotation_euler = posorient[3:] self.camera_rotation_mode = 'YZX'
elif isinstance(posorient, pd.Series): elif convention == 'sxzy':
self.camera_rotation_mode = 'XZY'
elif convention == 'syxz':
self.camera_rotation_mode = 'YXZ'
elif convention == 'szxy':
self.camera_rotation_mode = 'ZXY'
elif convention == 'szyx':
self.camera_rotation_mode = 'ZYX'
self.camera.location = \ self.camera.location = \
posorient.loc[['x', 'y', 'z']].values posorient.loc[['location'], ['x', 'y', 'z']].values
self.camera.rotation_euler = \ if convention != 'quaternion':
posorient.loc[['alpha_0', 'alpha_1', 'alpha_2']].values self.camera.rotation_euler = \
posorient.loc[[convention],
['alpha_0', 'alpha_1', 'alpha_2']].values
else:
self.camera_rotation_mode = 'QUATERNION'
self.camera.rotation_quaternion = \
posorient.loc[[convention],
['q_0', 'q_1', 'q_2', 'q_3']].values
else: else:
raise TypeError( raise TypeError(
'posorient must be of type array, list, or pandas Series') 'posorient must be of type array, list, or pandas Series')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment