function plotBB(points, boxsize, eixos, centroid)
% Plot the BB of a set of points according to the directions and
% points -> nx3 matrix with the points coordinates
% boxsize -> 3 vector with the lengths of the 3 axis of the box
% eixos -> 3x3 matrix with the directions of the axis of the box
% centroid-> 1x3 vector with the centroid of the points (it's mean).
% (c) Numerical Factory 2023
plot3(points(:,1),points(:,2),points(:,3),'.');
plot3(centroid(:,1),centroid(:,2),centroid(:,3),'ro');
%-------------------------------------
% Compute the 8 vertices of the box
%-------------------------------------
cv1=cm+0.5*(-midaX*v1-midaY*v2-midaZ*v3);
cv2=cm+0.5*( midaX*v1-midaY*v2-midaZ*v3);
cv3=cm+0.5*( midaX*v1+midaY*v2-midaZ*v3);
cv4=cm+0.5*(-midaX*v1+midaY*v2-midaZ*v3);
cv5=cm+0.5*(-midaX*v1-midaY*v2+midaZ*v3);
cv6=cm+0.5*( midaX*v1-midaY*v2+midaZ*v3);
cv7=cm+0.5*( midaX*v1+midaY*v2+midaZ*v3);
cv8=cm+0.5*(-midaX*v1+midaY*v2+midaZ*v3);
%-------------------------------------
% draw the edges of the box
%-------------------------------------
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');
plot3(aresta(:,1),aresta(:,2),aresta(:,3),'r');