function [] = plotCube(stewart, args)

arguments
    stewart
    args.Hc  (1,1) double {mustBeNumeric, mustBePositive} = 60e-3
    args.FOc (1,1) double {mustBeNumeric} = 50e-3
    args.color (4,1) double {mustBeNumeric} = [0,0,0,0.5]
    args.linewidth (1,1) double {mustBeNumeric, mustBePositive} = 2.5
    args.link_to_struts  logical {mustBeNumericOrLogical} = false
end

sx = [ 2; -1; -1];
sy = [ 0;  1; -1];
sz = [ 1;  1;  1];

R = [sx, sy, sz]./vecnorm([sx, sy, sz]);

L = args.Hc*sqrt(3);

p_xyz = R'*[[0;0;0],[L;0;0],[L;L;0],[0;L;0],[0;0;L],[L;0;L],[L;L;L],[0;L;L]] - [0;0;1.5*args.Hc];

% Position center of the cube
p_xyz = p_xyz + args.FOc*[0;0;1]*ones(1,8);

edges_order = [1 2 3 4 1];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);
edges_order = [5 6 7 8 5];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);
edges_order = [1 5];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);
edges_order = [2 6];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);
edges_order = [3 7];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);
edges_order = [4 8];
plot3(p_xyz(1,edges_order), p_xyz(2,edges_order), p_xyz(3,edges_order), '-', 'color', args.color, 'linewidth', args.linewidth);

if args.link_to_struts
    Fb = stewart.platform_M.Mb + stewart.geometry.FO_M;
    plot3([Fb(1,1), p_xyz(1,5)],...
          [Fb(2,1), p_xyz(2,5)],...
          [Fb(3,1), p_xyz(3,5)], '--', 'color', args.color, 'linewidth', args.linewidth);
    plot3([Fb(1,2), p_xyz(1,2)],...
          [Fb(2,2), p_xyz(2,2)],...
          [Fb(3,2), p_xyz(3,2)], '--', 'color', args.color, 'linewidth', args.linewidth);
    plot3([Fb(1,3), p_xyz(1,2)],...
          [Fb(2,3), p_xyz(2,2)],...
          [Fb(3,3), p_xyz(3,2)], '--', 'color', args.color, 'linewidth', args.linewidth);
    plot3([Fb(1,4), p_xyz(1,4)],...
          [Fb(2,4), p_xyz(2,4)],...
          [Fb(3,4), p_xyz(3,4)], '--', 'color', args.color, 'linewidth', args.linewidth);
    plot3([Fb(1,5), p_xyz(1,4)],...
          [Fb(2,5), p_xyz(2,4)],...
          [Fb(3,5), p_xyz(3,4)], '--', 'color', args.color, 'linewidth', args.linewidth);
    plot3([Fb(1,6), p_xyz(1,5)],...
          [Fb(2,6), p_xyz(2,5)],...
          [Fb(3,6), p_xyz(3,5)], '--', 'color', args.color, 'linewidth', args.linewidth);
end
