Selection of coordinate system for node translation

Dear all

I have a general question:
How do I select a coordinate system for a translation of a node?

I am interested in the rotated coordinate system of another node which I have previously defined, however, it always picks the std coordinate system orientation. Besides the example below I have also tried:
sRel=.GHReactionCenterNodeRotated1.sRel+{0,-0.015,0}*.GHReactionCenterNodeRotated1.ARel;
but also there I don't get a translation in the desired y-direction only.

Thank you for your help!
Best,
Johanna

    AnyRefNode    GHReactionCenterNodeRotated1 = {
      
      sRel=.GHReactionCenterNode.sRel;      
      
      AnyDrawRefFrame drw={ScaleXYZ={0.05,0.05,0.05};};
      AnyDrawNode drw2 = {ScaleXYZ={0.001,0.001,0.001}*2;};
      
      //Calculate rot matrix for cylinder using three points
      AnyMat33  Mat = RotMat(sRel,.EdgeNode1.sRel,.EdgeNode2.sRel);
      ARel= Mat;     
    };
    
    
    //achieve rotation of glenoid around point on inferior glenoid rim
    AnyRefNode    GHReactionTestNode = {
      
      //sRel=.GHReactionCenterNode.sRel;      
      // JO: change location of rotated node    
      sRel=.GHReactionCenterNodeRotated1.sRel+{0,0.03,0}*.GHReactionCenterNodeRotated1.ARel;
      
      AnyDrawRefFrame drw={RGB = {1,0,0}; ScaleXYZ={0.05,0.05,0.05};};
      AnyDrawNode drw2 = {RGB = {1,0,0}; ScaleXYZ={0.001,0.001,0.001}*2;}; 
      
      //Johanna: glenoid inclination -  using axis and angle
      AnyMat33 Mat2 = RotMat(30*pi/180, x);    
      ARel=.GHReactionCenterNodeRotated1.ARel*Mat2;      
    };

Hi Johanna,

I have tried your model and read the question a couple of times, but i am not 100% sure i understand what you are trying to achieve.

The model will move the node along the local y axis. and it will pick is orientation from the other node and rotate it 30 deg on x local axis.

Please provide some more details on what it is you need, i am pretty sure it is possible to do :wink:

Best regards
Søren

Dear Søren

Thank you for your reply!
I hope the image on the right is illustrating what is happening and what I want to achieve :slight_smile:
The green coordinate system is the initial orientation of the GHReactionCenterNodeRotated1 and the yellow one after the rotation according to the rotation matrix "Mat".
I would like to translate the red node ( GHReactionTestNode) along the yellow coordinate system and not along the green one.

Thank you and best regards
Johanna

PS: the image is based on the following defintion of the GHReaction Test Node

//achieve rotation of glenoid around point on inferior glenoid rim
AnyRefNode    GHReactionTestNode = {
  
  //sRel=.GHReactionCenterNode.sRel;      
  // JO: change location of rotated node    
  sRel=.GHReactionCenterNodeRotated1.sRel+{0,0.03,0};
  
  AnyDrawRefFrame drw={RGB = {1,0,0}; ScaleXYZ={0.05,0.05,0.05};};
  AnyDrawNode drw2 = {RGB = {1,0,0}; ScaleXYZ={0.001,0.001,0.001}*2;}; 
  
  //Johanna: glenoid inclination -  using axis and angle
  AnyMat33 Mat2 = RotMat(30*pi/180, x);    
  ARel=.GHReactionCenterNodeRotated1.ARel*Mat2;      
};

Hi Johanna,

Please this sample code

Main ={
  AnyFixedRefFrame GlobalRef ={
    AnyRefNode    Node1 = {
      sRel={0,0,0};      
      AnyDrawRefFrame drw={ScaleXYZ={0.05,0.05,0.05}; RGB = {0,1,0};};
      //random rot
      AnyMat33  Mat = RotMat(0.2*pi,x)*RotMat(0.2*pi,y)*RotMat(0.2*pi,z);
      ARel= Mat;     
    };
    
    AnyRefNode    RotatedNode= {
      AnyDrawRefFrame drw={RGB = {1,0,0}; ScaleXYZ={0.05,0.05,0.05};};
      
      AnyMat33 Mat2 = RotMat(30*pi/180, y)*RotMat(30*pi/180, x)*RotMat(30*pi/180, z);    
      ARel=.Node1.ARel*Mat2;     
      
      AnyRefNode    Translation = {
        sRel = {0,0.05,0};
        AnyDrawRefFrame drw={RGB = {1,0,1}; ScaleXYZ={0.05,0.05,0.05};};
      };
    };
  };
};

I am using a node inside the rotated node, this is the easiest way.

Best regards
Søren

Thank you Søren

Your example helped me understanding how node rotations and translations work!

Best,
Johanna

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.