CImage:DistanceWcs
The DistanceWcs method calculates the distance in WCS units between 2 image points measured in world coordinates. The related Distance method computes the distance for pixel coordinates.
nDistance = CImage:DistanceWcs( x1, y1, x2, y2) |
wherex1, y1, x2, y2 are world coordinate values and may be numbers or strings.
On success, this method returns nDistance as a number (see Remarks)
On failure, this method returns 0.
The DistanceWcs method returns a distance in world coordinate units. For angular coordinate systems, this would be measured in degrees. If the image does not contain a world coordinate calibration, then Mira interprets the values as pixel coordinates and the distance is reported in distance units. If the coordinate calibration is in equatorial form, you can retrieve distance in string format using DistanceWcsStr.
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.):
|
-- load the image from a |
|
-- point 1 |
|
-- point 2 |
|
-- make the measurement |
Alternatively, the following example supposes an astronomical image with an equatorial calibration and that the points are expressed in angular units:
|
-- load the image from a |
|
-- point 1 |
|
-- point 2 |
|
-- make the measurement |
CImage class, Distance, DistanceWcsStr, Image Coordinate System, Subpixel Coordinate Definition
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.