function PlotFig3(Pt, Op, C)
  % -----------------------------------------------------------------------
  % PlotFig3 - Draw a set of 3D line segments; some connected, some not.
  %
  % Args: Pt - a 4 x N matrix of endpoints [x y z 1]' in columns
  %              Pt(:,n) is the nth endpoint
  %       Op - a 1 x N-1 vector specifying move or draw operations
  %              Op(n) = 0: move from Pt(:,n) to Pt(:,n+1) without drawing
  %              Op(n) = 1: draw while moving from Pt(:,n) to Pt(:,n+1)
  %            a line joins Pt(:,n) to Pt(:,n+1) only when Op(n) = 1
  %       C  - a ColorSpec, eg, a character or an RGB triple 
  % Rtns: none
  % -----------------------------------------------------------------------

  jmax = size(Pt,2); if jmax < 2 return; end
  i = 1; imax = jmax - 1; h = ishold; f = 1;
  while i < jmax
    while i < imax % combine successive moves
      if Op(i) ~= 0 break; end; i = i + 1;
    end
    j = i + 1;
    while j < jmax % collect successive draws
      if Op(j) == 0 break; end; j = j + 1;
    end
    plot3(Pt(1,i:j), Pt(2,i:j), Pt(3,i:j), 'Color', C);
    if f & ~h hold on; f = 0; end
    i = j;
  end
  if ~h hold off; end
end
