ATTILTELEM sets new rotation parameters NEWELEM = ATTILTELEM(OLDELEM,PSI) PSI - rotation angle in radians POSITIVE ROTS corresponds to a CORKSCREW (right) rotation of the ELEMENT looking in the direction of the beam. (or CORKSCREW, aligned with s-axis) rotation of the ELEMENT The rotation matrixes are stored in fields R1 and R2 R1 = [cos(PSI) sin(PSI); -sin(PSI) cos(PSI)] R2 = R1' See also ATSHIFTELEM, ATMODELEM
0001 function elem = attiltelem(elem,PSI) 0002 %ATTILTELEM sets new rotation parameters 0003 % NEWELEM = ATTILTELEM(OLDELEM,PSI) 0004 % 0005 % PSI - rotation angle in radians 0006 % POSITIVE ROTS corresponds to a CORKSCREW (right) 0007 % rotation of the ELEMENT looking in the direction of the beam. 0008 % (or CORKSCREW, aligned with s-axis) rotation of the ELEMENT 0009 % The rotation matrixes are stored in fields R1 and R2 0010 % R1 = [cos(PSI) sin(PSI); -sin(PSI) cos(PSI)] 0011 % R2 = R1' 0012 % 0013 % See also ATSHIFTELEM, ATMODELEM 0014 0015 C = cos(PSI); 0016 S = sin(PSI); 0017 RM = diag([C C C C 1 1]); 0018 RM(1,3) = S; 0019 RM(2,4) = S; 0020 RM(3,1) = -S; 0021 RM(4,2) = -S; 0022 elem.R1 = RM; 0023 elem.R2 = RM'; 0024 end 0025