--- a
+++ b/Body/AAUHuman/Trunk/SegmentsThorax.any
@@ -0,0 +1,209 @@
+/**
+Definitions of Segments in the Thorax Part of the Spine.
+
+Abbrevitations:
+ALL = Anterior Longitudinal Ligament
+PLL = Posterior Longitudinal Ligament
+LS = Ligamentum Supraspinale
+LI = Ligamentum Interspinalia
+
+MF = Multifidi
+ILpl = Iliocostalis Lumborum pars lumborum (part of Erector Spinae)
+LTpl = Longissimus Thoracis pars lumborum (part of Erector Spinae)
+ILpt = Iliocostalis Lumborum pars thoracis (part of Erector Spinae)
+LTpt = Longissimus Thoracis pars thoracis (part of Erector Spinae)
+PM = Psoas Major
+QL = Quadratus Lumborum
+RA = Rectus Abdominis
+OE = Obliquus Externus
+OI = Obliquus Internus
+
+C = Costae
+CI = Crista Iliaca
+CP = Crista Pubica
+SIPS = Spina iliaca posterior superior
+SIPI = Spina iliaca Posterior inferior
+T = Thoracal hvirvel
+L = Lumbal hvirvel
+S = Sacral segment
+*/
+AnyFolder SegmentsThorax = { 
+  
+
+  AnySeg ThoraxSeg = {
+
+    AnyFolder &StdPar=..ModelParameters;
+    
+    r0=..SegmentsLumbar.L1Seg.T12L1JntNode.sRel*..SegmentsLumbar.L1Seg.Axes0'+..SegmentsLumbar.L1Seg.r0-T12L1JntNode.sRel*Axes0';
+    
+    // This file includes the trunk specifc scaling function
+    // and anatomical reference system
+    AnyFunTransform3D &GeomScale = ..Scaling.GeometricalScaling.ThoraxSeg.ScaleFunction;
+    #include "TrunkScalingAndAnatomicalFrame.any"
+    AnyVar MassS = ..Scaling.MassScaling.Thorax.MassScale;
+        
+    AnyVar MassStandard = ..StandardParameters.Trunk.Mass;
+    Mass = MassS*MassStandard;
+    
+    AnyVar UBHeight =  StdPar.Thorax.UBHeight; //0.50; //Upperbody height
+    AnyVar Radius = (Mass/(pi*UBHeight*1000))^0.5;
+    AnyVar Ixx = 0.25*Mass*Radius^2 + 1/12*Mass*UBHeight^2;
+    AnyVar Izz = Ixx;
+    AnyVar Iyy = 0.5*Mass*Radius^2;
+    
+    AnyMat33 JMatRot = AnatomicalFrameTrunk.ARel*{{Ixx,0,0},{0,Iyy,0},{0,0,Izz}}*AnatomicalFrameTrunk.ARel';
+    Jii = {JMatRot[0][0], JMatRot[1][1], JMatRot[2][2]};
+    Jij = {JMatRot[1][0], JMatRot[2][1], JMatRot[2][0]};
+
+    
+    sCoM = Scale(StdPar.Thorax.sCoM_pos);
+    JaboutCoMOnOff = On;
+        
+    AnyRefNode MoCapMarkerFrameAMMR24 = {}; ///< For backwards Compatibility with AMMR 2.4 MoCap Marker protocols    
+    //Incisura jungularis right and left
+    //the nodes are used for attachment of ShoulderArm block
+    AnyRefNode ij = {
+      AnyFloat Mirror = eye(3);
+      //This is the standard value for the ij it must be used in order to scale the model
+      //since nodes are inserted into this node.
+      //If the position of ij are to be adjusted it should be done by changing sRelStd 
+      AnyVec3 sRelStd = .StdPar.Thorax.ij_pos;  
+      sRel = .Scale(sRelStd);
+      // The rotation is adjusted to give same values as before the pelvic tilt adjust in AMMR 3.0.
+      ARel = .AnatomicalFrameTrunk.ARel * RotMat(6.491948543235*pi/180,z) * {{0, 0, -1}, {0, 1, 0}, {1, 0, 0}};
+    };
+    
+    AnyRefNode iji = {
+      AnyFloat Mirror = {{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
+      
+      //This is the standard value for the ij it must be used in order to scale the model
+      //since nodes are inserted into this node.
+      //If the position of ij are to be adjusted it should be done by changing sRelS 
+      AnyVec3 sRelStd = .StdPar.Thorax.iji_pos;    
+      sRel = .Scale(sRelStd);      
+      // The rotation is adjusted to give same values as before the pelvic tilt adjust in AMMR 3.0.
+      ARel = .AnatomicalFrameTrunk.ARel*RotMat(6.491948543235*pi/180,z) * {{0, 0, -1}, {0, 1, 0}, {1, 0, 0}};
+    };
+        
+    AnyRefNode T1C7JntNode = {sRel = .Scale(.StdPar.Thorax.T1C7JntNode_pos);};    
+    AnyRefNode T1T2JntNode = {sRel = .Scale(.StdPar.Thorax.T1T2JntNode_pos);};    
+    AnyRefNode T2T3JntNode = {sRel = .Scale(.StdPar.Thorax.T2T3JntNode_pos);};    
+    AnyRefNode T3T4JntNode = {sRel = .Scale(.StdPar.Thorax.T3T4JntNode_pos);};    
+    AnyRefNode T4T5JntNode = {sRel = .Scale(.StdPar.Thorax.T4T5JntNode_pos);};    
+    AnyRefNode T5T6JntNode = {sRel = .Scale(.StdPar.Thorax.T5T6JntNode_pos);};    
+    AnyRefNode T6T7JntNode = {sRel = .Scale(.StdPar.Thorax.T6T7JntNode_pos);};    
+    AnyRefNode T7T8JntNode = {sRel = .Scale(.StdPar.Thorax.T7T8JntNode_pos);};    
+    AnyRefNode T8T9JntNode = {sRel = .Scale(.StdPar.Thorax.T8T9JntNode_pos);};    
+    AnyRefNode T9T10JntNode = {sRel = .Scale(.StdPar.Thorax.T9T10JntNode_pos);};    
+    AnyRefNode T10T11JntNode = {sRel = .Scale(.StdPar.Thorax.T10T11JntNode_pos);};    
+    AnyRefNode T11T12JntNode = {sRel = .Scale(.StdPar.Thorax.T11T12JntNode_pos);};    
+    AnyRefNode T12L1JntNode = {sRel = .Scale(.StdPar.Thorax.T12L1JntNode_pos);};
+
+    AnyRefNode CTCVJntNode = {}; ///<placeholder for the rigid thorax
+    AnyRefNode CS          = {}; ///<placeholder for the rigid thorax
+    AnyRefNode RibNodes = {
+      AnyRefNode CTCVJntNodeR = {};    
+      AnyRefNode CTCVJntNodeL = {};    
+    };
+    
+    AnyRefNode ForceVectorNode = {sRel = .Scale(.StdPar.Thorax.ForceVectorNode_pos);};
+    
+
+    AnyRefNode T1C5Jnt = {sRel = .Scale(.StdPar.Thorax.T1C5Jnt_pos);};     
+    
+    AnyDrawSurf DrwSurf = {
+      FileName = ...STL.FilenameThoraxSegWithoutNeck; 
+      RGB = ...ColorRef.Segments;
+      ScaleXYZ={1.0,1.0,1.0};
+      Opacity = Main.DrawSettings.BonesOpacity.Thorax;
+      AnyFunTransform3D &Scale =.Scale;
+    };
+
+    AnyRefNode Right ={
+      AnyInt Sign = 1;
+      #include "ThoraxScapulaContactRibPoints.any"
+    };
+    AnyRefNode Left ={
+      AnyInt Sign = -1;
+      #include "ThoraxScapulaContactRibPoints.any"
+    };    
+
+  }; // End of ThoraxSeg
+  
+  AnyFolder &T12Seg = ThoraxSeg;
+  AnyFolder &T11Seg = ThoraxSeg;
+  AnyFolder &T10Seg = ThoraxSeg;
+  AnyFolder &T9Seg = ThoraxSeg;
+  AnyFolder &T8Seg = ThoraxSeg;
+  AnyFolder &T7Seg = ThoraxSeg;
+  AnyFolder &T6Seg = ThoraxSeg;
+  AnyFolder &T5Seg = ThoraxSeg;
+  AnyFolder &T4Seg = ThoraxSeg;
+  AnyFolder &T3Seg = ThoraxSeg;
+  AnyFolder &T2Seg = ThoraxSeg;
+  AnyFolder &T1Seg = ThoraxSeg;
+  
+  T1Seg = {
+    T1C7JntNode = {
+      // Rotated node with x axis parallel to the superior endplate surface
+      AnyRefNode RotNode = {
+        ARel = RotMat(0.5*(..T1SuperiorEndplateAnteriorNode.sRel + ..T1SuperiorEndplatePosteriorNode.sRel),
+                      ..T1SuperiorEndplateAnteriorNode.sRel,
+                      0.5*(..T1SuperiorEndplateAnteriorNode.sRel + ..T1SuperiorEndplatePosteriorNode.sRel) + (..T1SuperiorEndplateNodeL.sRel - ..T1SuperiorEndplateNodeR.sRel))*RotMat(pi/2,x);
+      };
+    };
+    
+    // Nodes at the anterior and posterior points on the superior endplate
+    AnyRefNode T1SuperiorEndplateAnteriorNode = {sRel = .Scale(.StdPar.T1.SuperiorEndplateAnteriorNode_pos);};
+    AnyRefNode T1SuperiorEndplatePosteriorNode = {sRel = .Scale(.StdPar.T1.SuperiorEndplatePosteriorNode_pos);};
+    
+    // Nodes at the right and left points on the superior endplate
+    AnyRefNode T1SuperiorEndplateNodeR = {sRel = .Scale(.StdPar.T1.Right.SuperiorEndplateNode_pos);};
+    AnyRefNode T1SuperiorEndplateNodeL = {sRel = .Scale(.StdPar.T1.Left.SuperiorEndplateNode_pos);};
+  };
+
+
+  #if BM_TRUNK_THORACIC_FUTURE == OFF
+    AnyFolder &SkullSeg = .SegmentsCervicalSpine.SkullSeg;
+  #endif
+  
+};
+
+SegmentsRibCage = {
+
+ RibsRight = {
+ 
+  AnyFolder &R12Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R11Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R10Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R9Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R8Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R7Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R6Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R5Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R4Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R3Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R2Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R1Seg = ..SegmentsThorax.ThoraxSeg;
+ 
+ };
+
+ RibsLeft = {
+ 
+  AnyFolder &R12Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R11Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R10Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R9Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R8Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R7Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R6Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R5Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R4Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R3Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R2Seg = ..SegmentsThorax.ThoraxSeg;
+  AnyFolder &R1Seg = ..SegmentsThorax.ThoraxSeg;
+ 
+ };
+
+
+};