A Scilab script to make an animation of a block in a translational motion along the x-axis is shown in Code 1. The animation produced by this script is shown in Movie 1.
// anim_block_translate.sce clear; xdel(winsid()); exec('eulerXYZ.sci', -1); exec('transver.sci', -1); exec('genpat.sci', -1); exec('calcBlock.sci', -1); // Block spec Lx = 0.15; Ly = 0.05; Lz = 0.30; // Motion data t = (0:0.001:1)'; // Time data position = [0.5*sin(2*%pi*t), 0*t, 0*t]; // Position data angles = [0*t, 0*t, 0*t]; // Orientation data (XYZ Euler angles) // Initial patches r_ini = position(1,:)'; R_ini = eulerXYZ(angles(1,1), angles(1,2), angles(1,3)); patches_ini = calcBlock(r_ini, R_ini, Lx, Ly, Lz); // Draw initial figure h_fig = figure; h_fig.background = 8; drawlater(); h_pat = plot3d(patches_ini.x, patches_ini.y, patches_ini.z); h_pat.color_mode = 4; h_pat.foreground = 1; h_pat.hiddencolor = 4; // Axes settings xlabel("x"); ylabel("y"); zlabel("z"); h_axes = gca(); h_axes.isoview = "on"; h_axes.box = "off"; h_axes.rotation_angles = [63.5, -127]; h_axes.data_bounds = [-0.5, -0.5, -0.5; 0.7, 0.5, 0.5]; xgrid; // Compute patches at each time for i = 1:length(t) r = position(i,:)'; R = eulerXYZ(angles(i,1), angles(i,2), angles(i,3)); patches(i) = calcBlock(r, R, Lx, Ly, Lz); end // Animation Loop for i = 1:length(t) drawlater(); h_pat.data.x = patches(i).x; h_pat.data.y = patches(i).y; h_pat.data.z = patches(i).z; drawnow(); end