Vector directions in DrawJointReations.any file

Hi,

In the ‘\AMMRV1.2\Body\AAUHuman\ToolBox\JointReactions’ folder there is the ‘DrawJointReactions.any’ file.

I attach the code:

AnyFolder DrawJointReactions={
  
  AnyForceMomentMeasure ForceMomentMeasure={
    AnyForceBase &ref1=..Constraints.Reaction;
    AnyRefFrame &ref2=..ref1;
  };

  AnyDrawVector DrawFX = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 F=.ForceMomentMeasure.F*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Lin.ScaleFactor*{-1,0,0}*F[0];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = {0,1,0};//DrawRef.DrawSettingsJointReactions.Lin.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
  };

  AnyDrawVector DrawFY = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 F=.ForceMomentMeasure.F*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Lin.ScaleFactor*{0,-1,0}*F[1];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = {0,1,0};//DrawRef.DrawSettingsJointReactions.Lin.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
  };
   
  AnyDrawVector DrawFZ = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 F=.ForceMomentMeasure.F*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Lin.ScaleFactor*{0,0,-1}*F[2];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = {0,1,0};//.DrawRef.DrawSettingsJointReactions.Lin.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
  };

  AnyDrawVector DrawMX = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 M=.ForceMomentMeasure.M*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Rot.ScaleFactor*{-1,0,0}*M[0];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = ..DrawRef.DrawSettingsJointReactions.Rot.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Rot.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;
  };

  
  
  AnyDrawVector DrawMY = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 M=.ForceMomentMeasure.M*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Rot.ScaleFactor*{0,-1,0}*M[1];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = ..DrawRef.DrawSettingsJointReactions.Rot.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Rot.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;  
  };
   
  AnyDrawVector DrawMZ = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 M=.ForceMomentMeasure.M*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Rot.ScaleFactor*{0,0,-1}*M[2];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = ..DrawRef.DrawSettingsJointReactions.Rot.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Rot.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Rot.Thickness;
  };
  
};

I guess that ‘…ref1’ in the AnyForceMomentMeasure is the point of interest.

Let’s see a portion of above code:

  AnyDrawVector DrawFX = {
    
    AnyRefFrame &ref = ..ref1;
    AnyVec3 F=.ForceMomentMeasure.F*..ref1.Axes;
    Vec = ..DrawRef.DrawSettingsJointReactions.Lin.ScaleFactor*{-1,0,0}*F[0];
    GlobalCoord = Off;
    PointAway = Off;
    DrawCoord = Off;
    Line.RGB = {0,1,0};//DrawRef.DrawSettingsJointReactions.Lin.RGB;
    Line.Thickness = ..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
    Line.End.Thickness = 4*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;  
    Line.End.Length = 2*..DrawRef.DrawSettingsJointReactions.Lin.Thickness;
  };

I’d like to ask why the ‘Vec’ has the opposite direction by multiplying {-1,0,0}.

Best regards and thanks in advance,
Moonki

Hi Moonki,

Ref1 is the point of interest of the AnyForceMomentMeasure, that is right. It will usually be the first node of the joint as this particular file is meant to be included inside a joint definition.

As the -1 factor it is just a convention for the visual display of the vector. It could have been done as well by setting the PointAway menber On or Off.

Best regards, Sylvain.

Hi, Sylvain.

Thanks for your reply. I’d like to ask of you more questions.

In the AnyDrawVector objects in the code, the ‘PointAway’ is set as ‘Off’. I understand that in this case the AnyDrawVector displays a force vector that is ‘acting’ on the point of interest.

Then I think that there is no need to multiply -1 factor to the force that is calculated by AnyForceMomentMeasure. Because I understand that AnyForceMomentMeasure tells us 3 forces and 3 moments in view of the point of interest.

Would you please explain if my guess is wrong?

Best regards and thanks again,
Moonki

Hi Moonki,

It is right the the AnyForceMomentMeasure returns forces and moments acting on the point of interest.
But the menber PointAway does not change the direction of the vector. I attached a small picture to make it more clear. Please refer to it. The PointAway menber is just to display the vector on one side or the other of the node, for example to avoid it being hidden inside a CAD file. But it is always the same vector.

Now you’ll see in the picture that when the arrow heads are not displayed, using a -1 factor will have the same visual effect as the PointAway menber.

So strictly speaking it is right that we should have used PointAway = On instead of the -1 factor. But at the end the graphical result is the same, so it does not matter that much.

Best regards, Sylvain.

Hi Sylvain,

Thanks very much for your kind explanation using the picture.

It helps me to understand it clearly. The PointAway member then determines whether the point of interest may be the start or end node of the display vector graphically.

Best regards and thanks again,
Moonki