CImage:Distance
The Distance method calculates the Distance in pixel coordinate units along a line formed by 2 image points. To measure a distance in world coordinates, use the DistanceWcs method.
nDistance = CImage:Distance( x1, y1, x2, y2 ) where |
x1,y1 are pixel coordinates of the first point.
x2,y2 are pixel coordinates of the second point.
nDistance is the distance, measured in pixel units.
On success, this method returns nDistance.
On failure, this method returns 0.
The Distance method returns a distance in pixel units. The DistanceWcs and DistanceWcsStr methods return distance measured in calibrated world coordinate units rather than pixel coordinates.
Assume an image is displayed and attached to a CImageView named V. The following script measures the distance between two points (x1,y1) and (x2,y2) when the coordinates are in pixel units:
|
-- load the image from a |
|
-- point 1 |
|
-- point 2 |
|
-- make the measurement |