ThorstenHellert / SC

6 stars 4 forks source link

Tech Note in SCgetTransformation.m help #37

Closed oscarxblanco closed 7 months ago

oscarxblanco commented 8 months ago

Dear Thorsten,

the function SCgetTransformation is quite useful. I have checked the values of T1 and T2 in the case of a pitch applied at the entrance of a drift and it agrees well with the geometry sketch of what I would expect.

The case when the rotation is applied at the center did not fully match my sketch. There is a small mismatch at the entrance of the element, but, iIt might be due to a misinterpretation of the axes.

While looking at the help message I noticed you refer to a Tech Note: https://github.com/ThorstenHellert/SC/blob/98dc91d5d27148dc779a1de5337725d111fec3d4/SCgetTransformation.m#L19

Could you please, complement the help info, and if possible make it public ?

Best regards, o

P.S. I will leave here below the test script I did for tilt, pitch and yaw applied at the entrance or the center of an element.

%% test element rotations
% oblanco 2023nov23
d1 = atdrift('D1',0.3);
rp1 = atringparam('RINGtest',energy=3e9);
RINGtest =[{rp1};{d1}];
RINGtest = atsetenergy(RINGtest,3e9);

%% rotations
dx = 0;
dy = 0;
dz = 0;
atilt  = 0.0;
apitch = 0.2;
ayaw   = 0.0;
ax =  apitch;
ay =  ayaw;
az =  atilt;
magTheta = 0;
magLength = RINGtest{2}.Length;
[T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','entrance');
%[T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','center');
T1andT2fromSC=[T1';T2']
R1
R2

% T1 and T2
T1andT2fromSC
%  from theoretical rotation at entrance
T1andT2theo=[0 0 0 tan(apitch) 0 0; 0 0 -magLength*tan(apitch) -sin(apitch) 0 magLength*(sec(apitch)-1)]
% from theoretical rotation at center
%T1andT2theo=[   0 0 -magLength/2*sin(apitch) tan(apitch) 0 magLength/2*(1-cos(apitch)); ...
%                0 0 -magLength/2*tan(apitch) -sin(apitch) 0 magLength/2*(sec(apitch)-1)]

And here is the output when applying the rotation at the entrance

T1andT2fromSC =

         0         0         0    0.2027         0         0
         0         0   -0.0608   -0.1987         0    0.0061
T1andT2theo =

         0         0         0    0.2027         0         0
         0         0   -0.0608   -0.1987         0    0.0061

and the output when applying the rotation at the center (same script but commenting few lines and uncommenting others). You will see that T1(3) slightly disagrees.

T1andT2fromSC =

         0         0   -0.0292    0.2027         0    0.0030
         0         0   -0.0304   -0.1987         0    0.0031

T1andT2theo =

         0         0   -0.0298    0.2027         0    0.0030
         0         0   -0.0304   -0.1987         0    0.0031
oscarxblanco commented 8 months ago

Dear Thorsten,

while checking the code itself I think it would be worth including in the help message the rotation order because it is not commutative. I believe tilt/roll is done first, then yaw and then pitch in your implementation.

ThorstenHellert commented 8 months ago

Hi Oscar, we published the note here (I should update the help message): https://www.sciencedirect.com/science/article/pii/S0168900222007793

On Nov 23, 2023, at 23:55, oscarxblanco @.***> wrote:

Dear Thorsten,

the function SCgetTransformation is quite useful. I have checked the values of T1 and T2 in the case of a pitch applied at the entrance of a drift and it agrees well with the geometry sketch of what I would expect.

The case when the rotation is applied at the center did not fully match my sketch. There is a small mismatch at the entrance of the element, but, iIt might be due to a misinterpretation of the axes.

While looking at the help message I noticed you refer to a Tech Note: https://github.com/ThorstenHellert/SC/blob/98dc91d5d27148dc779a1de5337725d111fec3d4/SCgetTransformation.m#L19

Could you please, complement the help info, and if possible make it public ?

Best regards, o

P.S. I will leave here below the test script I did for tilt, pitch and yaw applied at the entrance or the center of an element.

%% test element rotations % oblanco 2023nov23 d1 = atdrift('D1',0.3); rp1 = atringparam('RINGtest',energy=3e9); RINGtest =[{rp1};{d1}]; RINGtest = atsetenergy(RINGtest,3e9);

%% rotations dx = 0; dy = 0; dz = 0; atilt = 0.0; apitch = 0.2; ayaw = 0.0; ax = apitch; ay = ayaw; az = atilt; magTheta = 0; magLength = RINGtest{2}.Length; [T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','entrance'); %[T1,T2,R1,R2] = SCgetTransformation(dx,dy,dz,ax,ay,az,magTheta,magLength,'refPoint','center'); T1andT2fromSC=[T1';T2'] R1 R2

% T1 and T2 T1andT2fromSC % from theoretical rotation at entrance T1andT2theo=[0 0 0 tan(apitch) 0 0; 0 0 -magLengthtan(apitch) -sin(apitch) 0 magLength(sec(apitch)-1)] % from theoretical rotation at center %T1andT2theo=[ 0 0 -magLength/2sin(apitch) tan(apitch) 0 magLength/2(1-cos(apitch)); ... % 0 0 -magLength/2tan(apitch) -sin(apitch) 0 magLength/2(sec(apitch)-1)] And here is the output when applying the rotation at the entrance

T1andT2fromSC =

     0         0         0    0.2027         0         0
     0         0   -0.0608   -0.1987         0    0.0061

T1andT2theo =

     0         0         0    0.2027         0         0
     0         0   -0.0608   -0.1987         0    0.0061

and the output when applying the rotation at the center (same script but commenting few lines and uncommenting others). You will see that T1(3) slightly disagrees.

T1andT2fromSC =

     0         0   -0.0292    0.2027         0    0.0030
     0         0   -0.0304   -0.1987         0    0.0031

T1andT2theo =

     0         0   -0.0298    0.2027         0    0.0030
     0         0   -0.0304   -0.1987         0    0.0031

— Reply to this email directly, view it on GitHub https://github.com/ThorstenHellert/SC/issues/37, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHUUFTXXAH46ZYO2ZEQDPDYGBHIHAVCNFSM6AAAAAA7YXQP2CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDSMRWHE3DGMI. You are receiving this because you are subscribed to this thread.