CImage:DistanceWcsStr


The DistanceWcsStr method calculates the distance in WCS units between 2 image points measured in world coordinates and returns the result as a string. The related Distance method computes the Distance for pixel coordinates.

Syntax

sDistance = CImage:DistanceWcsStr( x1, y1, x2, y2)

bullet.gif    wherex1, y1, x2, y2 are world coordinate values and may be expressed as numbers or strings.

bullet.gif    On success, this method returns the distance as a string.

bullet.gif    On failure, this method returns nil

Remarks

The DistanceWcsStr method returns a distance in world coordinate units as a string. Also see the related DistanceWcs method that returns the world coordinate calibrated distance as a number.

Example

Assume an image is displayed and attached to a CImageView named V. The following script measures the Distance between between two points (x1,y1) and (x2,y2) when the coordinates are in distance units (pixels, mm, microns, etc.):

 

I = V:GetImage()

-- load the image from a

x1 = 442.5 ; y1 = 220.44

-- point 1

x2 = 1.554 ; y2 = 20.552

-- point 2

sD = I:DistanceWcsStr(x1,y1,x2,y2)

-- make the measurement, returns a string

Alternatively, the following example supposes an astronomical image with an equatorial calibration and that the points are expressed in angular units:

 

V:GetImage()

-- load the image from a

x1 = "05:42:15.52" ; y1 = "20:40:12.5"

-- point 1

x2 = "05:42:44.12" ; y2 = "20:42:42.1"

-- point 2

sD = I:DistanceWcsStr(x1,y1,x2,y2)

-- make the measurement, returns a string

Related Topics

CImage class, Distance, DistanceWcs, Image Coordinate System, Subpixel Coordinate Definition


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.