%mathpiper,def="Distance"

Distance(PointA_IsPoint,PointB_IsPoint) <--
[
    Local(x1,x2,y1,y2,distance);

    x1 := PointA[1];
    x2 := PointB[1];
    y1 := PointA[2];
    y2 := PointB[2];
    
    distance := Sqrt((x2 - x1)^2 + (y2 - y1)^2);
];

%/mathpiper



%mathpiper_docs,name="Distance",categories="User Functions;Analytic Geometry",access="experimental"
*CMD Distance --- returns the distance between two points
*STD
*CALL
	Distance(p1, p2)
*PARMS

{p1} -- the first point

{p2} -- the second point

*DESC

This function calculates the distance between two points using the 
distance formula.

*E.G.

In> PointA := Point(2,3)
Result: {2,3}
	
In> PointB := Point(6,8)
Result: {6,8}
	
In> Distance(PointA, PointB)
Result: Sqrt(41)

*SEE IsPoint, Point, Midpoint, Slope, Segment
%/mathpiper_docs
