function plotAxisTriad(bbox,hdl)
% PLOTAXISTRIAD - Plots cartesian axis triad based on input bounding box
%

%   Copyright 2014-2023 The MathWorks, Inc.

maxdim = max([abs(bbox(1,1)-bbox(1,2)), abs(bbox(2,1)-bbox(2,2)), abs(bbox(3,1)-bbox(3,2))]);
orgn = (ones(3,3).*(bbox(:,1) - 0.3*maxdim))';
vMag = .3*maxdim;
vec = vMag*eye(3);
labPts = (orgn + vec);
if nargin < 2
    quiver3(orgn(:,1),orgn(:,2),orgn(:,3),vec(:,1),vec(:,2),vec(:,3), 'Color', 'red');
    hdl = gca;
else
    quiver3(hdl,orgn(:,1),orgn(:,2),orgn(:,3),vec(:,1),vec(:,2),vec(:,3), 'Color', 'red');
end
text(labPts(:,1), labPts(:,2),labPts(:,3),['x' 'y' 'z']','Parent',hdl,...
    'HorizontalAlignment','center','Clipping','on','FontName','Helvetica','FontSize',10);
end
