-
Notifications
You must be signed in to change notification settings - Fork 164
/
Vector.mo
107 lines (102 loc) · 4.09 KB
/
Vector.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
within Modelica.Mechanics.MultiBody.Visualizers.Advanced;
model Vector "Visualizing a vector quantity (force, torque, etc.)"
extends ModelicaServices.Animation.Vector;
extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialVector;
annotation (
Documentation(info="<html>
<p>
Model <strong>Vector</strong> defines a vector that is dynamically
visualized at the defined location (see variables below).
The vector length does not represent
a physical length, but a different 3-dimensional quantity
(such as force, torque, speed, …), except for <strong>RelativePosition</strong>.
That allows the vectors of similar quantities to be scaled appropriately during post-processing.
This is useful, even for <strong>RelativePosition</strong> and in that case to disable or
exaggerate the relative positions.
</p>
<p>
The dialog variables <code>R</code>, <code>r</code>, <code>coordinates</code>, <code>color</code>,
<code>specularCoefficient</code>, <code>quantity</code>, <code>headAtOrigin</code>, and <code>twoHeadedArrow</code>
are declared as (time varying) <strong>input</strong> variables.
If the default equation is not appropriate, a corresponding
modifier equation has to be provided in the
model where a <strong>Vector</strong> instance is used, e.g., in the form
</p>
<blockquote><pre>
Visualizers.Advanced.Vector vectorForce(coordinates = {sin(time),cos(time),0});
</pre></blockquote>
<p>
Variable <code>color</code> is an Integer vector with 3 elements,
{r, g, b}, and specifies the color of the shape.
{r, g, b} are the "red", "green" and "blue" color parts.
Note, r, g and b are given in the range 0 … 255.
The predefined type
<a href=\"modelica://Modelica.Mechanics.MultiBody.Types.Color\">MultiBody.Types.Color</a>
contains a menu definition of the colors used in the MultiBody
library together with a color editor.
</p>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
100,100}}), graphics={
Polygon(
points={{20,60},{100,0},{20,-60},{20,60}},
fillColor={60,120,180},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Text(
extent={{-150,105},{150,65}},
textString="%name",
textColor={0,0,255}),
Rectangle(
extent={{-100,-28},{20,28}},
fillColor={60,120,180},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Rectangle(
extent={{-100,-8},{20,-20}},
fillColor={46,94,140},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Rectangle(
extent={{-100,-20},{20,-28}},
fillColor={26,53,80},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Polygon(
points={{20,-20},{100,0},{20,-48},{20,-20}},
fillColor={46,93,140},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Polygon(
points={{20,-60},{100,0},{20,-48},{20,-60}},
fillColor={26,53,80},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Rectangle(
extent={{-100,26},{20,4}},
fillColor={73,147,220},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-100,22},{20,14}},
fillColor={85,170,255},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Polygon(
points={{20,56},{100,0},{20,18},{20,56}},
fillColor={72,149,220},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0}),
Polygon(
points={{20,48},{100,0},{20,36},{20,48}},
fillColor={85,170,255},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None,
lineColor={0,0,0})}));
end Vector;