42 lines
993 B
Plaintext
42 lines
993 B
Plaintext
model vis2d
|
|
import Modelica.Mechanics.MultiBody.Visualizers;
|
|
import Modelica.Mechanics.MultiBody.Frames;
|
|
|
|
parameter Real L = 1;
|
|
parameter Real w = 0.02;
|
|
parameter Real orbRadius = 0.04;
|
|
|
|
input Real r[3];
|
|
input Real phi;
|
|
|
|
Visualizers.Advanced.Shape link(
|
|
shapeType = "cylinder",
|
|
length = L,
|
|
width = w,
|
|
height = w,
|
|
r_shape = {-L / 2, 0, 0},
|
|
lengthDirection = {1, 0, 0},
|
|
widthDirection = {0, 1, 0},
|
|
r = r,
|
|
R = Frames.from_T(
|
|
[cos(phi), -sin(phi), 0;
|
|
sin(phi), cos(phi), 0;
|
|
0, 0, 1],
|
|
zeros(3)));
|
|
|
|
Visualizers.Advanced.Shape orb(
|
|
shapeType = "sphere",
|
|
length = 2 * orbRadius,
|
|
width = 2 * orbRadius,
|
|
height = 2 * orbRadius,
|
|
r_shape = {L / 2 - orbRadius, 0, 0},
|
|
lengthDirection = {1, 0, 0},
|
|
widthDirection = {0, 1, 0},
|
|
r = r,
|
|
R = Frames.from_T(
|
|
[cos(phi), -sin(phi), 0;
|
|
sin(phi), cos(phi), 0;
|
|
0, 0, 1],
|
|
zeros(3)));
|
|
end vis2d;
|