%PLOTFRAME  plot coordinate frame
% Draws coordinate axes of unit length specified by transformation T,
% labels axes as x, y, and z
%
% Syntax:  plotframe(T)
%
% Inputs:
%    T - transformtion

% Author: Travis Hydzik
% Last revision: 19 October 2004

function plotframe(T)
    % origin
    o = T*[0 0 0 1]';

    % x axis
    x = o + T*[1 0 0 0]';
    line([o(1) x(1)], [o(2) x(2)], [o(3) x(3)]);
    text(x(1), x(2), x(3), 'x');
    
    % y axis
    y = o + T*[0 1 0 0]';
    line([o(1) y(1)], [o(2) y(2)], [o(3) y(3)]);
    text(y(1), y(2), y(3), 'y');
    
    % z axis
    z = o + T*[0 0 1 0]';
    line([o(1) z(1)], [o(2) z(2)], [o(3) z(3)]);
    text(z(1), z(2), z(3), 'z');