Calculate distance between two points.
If both points have a z property, the distance is 3D distance is calculated.
If only one point has a z, it is ignored.
// Distance between two points constptA = { x:0.5, y:0.8 }; constptB = { x:1, y:0.4 }; distance(ptA, ptB); // Or, provide x,y as parameters distance(ptA, 0.4, 0.9);
// Distance from ptA to x: 0.5, y:0.8, z: 0.1 constptC = { x:0.5, y:0.5, z:0.3 }; // With x,y,z as parameters: distance(ptC, 0.5, 0.8, 0.1);
Calculate distance between two points. If both points have a
z
property, the distance is 3D distance is calculated. If only one point has az
, it is ignored.Param: a
First point
Param: xOrB
Second point, or x coord
Param: y
y coord, if x coord is given
Param: z
Optional z coord, if x and y are given.
Returns