CImage:Angle
The Angle method calculates the angle in degrees between a line formed by 2 image points measured in pixel coordinates. To measure an angle in world coordinates, use the AngleWcs method.
nAngle = CImage:Angle( x1, y1, x2, y2)
x1, y1,x2, y2 are pixel coordinate values and may be expressed as numbers or strings.
On success, this method returns nAngle as a number.
On failure, this method returns the default value 0.
The Angle method returns an angle in degrees. The angle is measured positive with increasing x value and increasing y value. For a discussion of angle and its measurement in different image types, see Angle Measurement Definition.
Assume an image is displayed and attached to a CImageView named V. The following script fragment measures the angle formed by two points (x1,y1) and (x2,y2) when the coordinates are in pixel units:
I = V:GetImage() |
-- load the image from a |
x1 = 442.5 ; y1 = 220.44 |
-- point 1 |
x2 = 1.554 ; y2 = 20.552 |
-- point 2 |
A = I:Angle(x1,y1,x2,y2) |
-- make the measurement |