Y-Axis Rotation Matrix
This example generates a rotation matrix that rotates a vector about the y-axis by a specified angle.
from csdl_om import Simulatorfrom csdl import Modelimport csdlimport numpy as np
class ExampleScalarRotY(Model):
def define(self): angle_val3 = np.pi / 3
angle_scalar = self.declare_variable('scalar', val=angle_val3)
# Rotation in the y-axis for scalar self.register_output('scalar_Rot_y', csdl.rotmat(angle_scalar, axis='y'))
sim = Simulator(ExampleScalarRotY())sim.run()
print('scalar', sim['scalar'].shape)print(sim['scalar'])print('scalar_Rot_y', sim['scalar_Rot_y'].shape)print(sim['scalar_Rot_y'])
[1.04719755]scalar_Rot_y (3, 3)[[ 0.5 0. 0.8660254] [ 0. 1. 0. ] [-0.8660254 0. 0.5 ]]