;+
; CARTDIST - just return the distance between two vectors in 
; Cartesian N-space.  You pass it two N-vectors, and it applies
; Pythagoras' Theorem.  
;
; Hastily crufted together 11-Jan-97 Craig DeForest
;-
function CARTDIST,v1,v2
if ((not isvalid(v1) or not isvalid(v2)) or $
	(n_elements(v1) ne n_elements(v2))) then $
	message,"CARTDIST: You must specify two vectors of the same nonzero dimension."

s = size(v1)

if ((s(0) eq 0) or (s(0) eq 1)) then $
	return, sqrt(total((v2(*) - v1(*))^2)) $
else if(s(0) eq 2) then $
	return, sqrt(total((v2(*,*) - v1(*,*))*(v2(*,*) - v1(*,*)),1))
end
