function h=jplot(X,A,fig)
% h=jplot(X,A,fig)
% plots a 3D mesh specified by the adjacency mtx A
% the coordinates are specified in the 3 x npts matrix A

if(nargin<3)
  figure
else
  figure(fig)
end

plot3(X(1,:),X(2,:),X(3,:),'r.')

hold on

npts=size(X,2);
for count1=1:npts
  for count2=count1+1:npts
    if(A(count1,count2))
      plot3([X(1,count1) X(1,count2)],[X(2,count1) X(2,count2)], ...
	    [X(3,count1) X(3,count2)]);
    end
  end
end

hold off

%%%temp%%%
show_text=1;
if(show_text)
  text(X(1,:),X(2,:),X(3,:),int2str([1:npts]'))
end
