MATLAB: How to make patch cylinder wheels for this semi truck

figure
view(3)
grid on
%lorry
vertices_lorry = [0 1 0.5 ; 4 1 0.5; 6.5 1 0.5; 6.5 1 1.2; 6 1 1.3;...
5 1 1.8; 4 1 1.8; 4 1 2; 0 1 2; ... % postive y of lorry
0 -1 0.5; 4 -1 0.5; 6.5 -1 0.5; 6.5 -1 1.2; 6 -1 1.3;...
5 -1 1.8; 4 -1 1.8; 4 -1 2; 0 -1 2]; % negative y of lorry
faces_lorry_cargo = [10 1 9 18; 1 2 8 9; 8 9 18 17; 10 11 17 18; 7 8 17 16;...
1 2 11 10];
faces_lorry_driver = [7 6 15 16 16 16; 5 6 15 14 14 14; 5 4 13 14 14 14;...
3 4 13 12 12 12; 2 3 4 5 6 7; 11 12 13 14 15 16; 2 3 12 11 11 11];
patch('Faces',faces_lorry_cargo,'Vertices',vertices_lorry,'FaceColor','#86DA7D','EdgeColor','k');
patch('Faces',faces_lorry_driver,'Vertices',vertices_lorry,'FaceColor','#868686','EdgeColor','k');
I am trying to build a truck in Matlab but I cannot figure out how to place 4 different half cylinder "wheels" on the bottom. How can I do this?
The wheels should go around 180 deg from the bottom. the rear wheel is centered 1m from the back and the wheel base is 3.95. the wheels are 0.2m thick.

Best Answer

Try this
t = linspace(0,2*pi,20)';
[x,y] = pol2cart(t,1); % create data for circle
v0 = x*0;
X = [v0 x x v0];
Z = [v0 y y v0];
Y = [v0-1 v0-1 v0+1 v0+1]*1.2;
hold on
surf(X,Y,Z,'facecolor','y') % draw wheel
surf(X+4,Y,Z,'facecolor','y') % draw wheel +4 position
hold off
axis vis3d
Experiment