% make_block_general.m

clear; close all;

% Reference position
r = [1; 1; 1];

% Reference orientation
R = eulerXYZ(-pi/3, 0, pi/6);

% Side lengths
Lx = 0.15;
Ly = 0.05;
Lz = 0.30;

% Vertices
vertices_0 = [
    0,   0,  0;  % #1
    Lx,  0,  0;  % #2
    0,  Ly,  0;  % #3
    0,   0, Lz;  % #4
    Lx, Ly,  0;  % #5
    0,  Ly, Lz;  % #6
    Lx,  0, Lz;  % #7
    Lx, Ly, Lz]; % #8

vertices = r' + vertices_0*R';

% Faces
faces = [
    1, 2, 5, 3;  % #1
    1, 3, 6, 4;  % #2
    1, 4, 7, 2;  % #3
    4, 7, 8, 6;  % #4
    2, 5, 8, 7;  % #5
    3, 6, 8, 5]; % #6

% Draw patch
figure(1);
h = patch('Faces', faces, 'Vertices', vertices, 'FaceColor', 'y');

% Axes settings
xlabel('x'); ylabel('y'); zlabel('z');
axis vis3d equal;
view([-37.5, 30]);
camlight;
grid on;
xlim([0.8, 1.3]);
ylim([0.9, 1.4]);
zlim([0.8, 1.3]);