Skip to content

Commit

Permalink
Correct units for normalizing vectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Sep 18, 2023
1 parent 438d8f8 commit 4ada630
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Modelica/Math/package.mo
Expand Up @@ -255,7 +255,7 @@ v = {2, -4, -2, -1};
input Real v[:] "Real vector";
input Real eps(min=0.0)=100*Modelica.Constants.eps
"if |v| < eps then result = v/eps";
output Real result[size(v, 1)] "Input vector v normalized to length=1";
output Real result[size(v, 1)](each final unit="1") "Input vector v normalized to length=1";

algorithm
/* This function has the inline annotation. If the function is inlined:
Expand Down
Expand Up @@ -4,9 +4,9 @@ function from_nxy "Return orientation object from n_x and n_y vectors"
import Modelica.Math.Vectors.length;
import Modelica.Math.Vectors.normalize;

input Real n_x[3](each final unit="1")
input Real n_x[3]
"Vector in direction of x-axis of frame 2, resolved in frame 1";
input Real n_y[3](each final unit="1")
input Real n_y[3]
"Vector in direction of y-axis of frame 2, resolved in frame 1";
output TransformationMatrices.Orientation T
"Orientation object to rotate frame 1 into frame 2";
Expand Down
4 changes: 2 additions & 2 deletions Modelica/Mechanics/MultiBody/Frames/from_nxy.mo
@@ -1,9 +1,9 @@
within Modelica.Mechanics.MultiBody.Frames;
function from_nxy "Return fixed orientation object from n_x and n_y vectors"
extends Modelica.Icons.Function;
input Real n_x[3](each final unit="1")
input Real n_x[3]
"Vector in direction of x-axis of frame 2, resolved in frame 1";
input Real n_y[3](each final unit="1")
input Real n_y[3]
"Vector in direction of y-axis of frame 2, resolved in frame 1";
output Orientation R "Orientation object to rotate frame 1 into frame 2";
algorithm
Expand Down
4 changes: 2 additions & 2 deletions Modelica/Utilities/Internal.mo
Expand Up @@ -21,9 +21,9 @@ package PartialModelicaServices
"Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog);
input SI.Position r_shape[3]={0,0,0}
"Position vector from origin of object frame to shape origin, resolved in object frame" annotation(Dialog);
input Real lengthDirection[3](each final unit="1")={1,0,0}
input Real lengthDirection[3]={1,0,0}
"Vector in length direction, resolved in object frame" annotation(Dialog);
input Real widthDirection[3](each final unit="1")={0,1,0}
input Real widthDirection[3]={0,1,0}
"Vector in width direction, resolved in object frame" annotation(Dialog);
input SI.Length length=0 "Length of visual object" annotation(Dialog);
input SI.Length width=0 "Width of visual object" annotation(Dialog);
Expand Down

0 comments on commit 4ada630

Please sign in to comment.