Main Content


Return angle between Distance tool and horizontal axis

getAngleFromHorizontal is not recommended. Use one of the ROI classes instead, described in Create ROI Shapes.


angle = getAngleFromHorizontal(h) returns the angle, in degrees, between the line defined by the Distance tool, h, and the horizontal axis.

Input Arguments

collapse all

Distance tool, specified as an imdistline object.

Output Arguments

collapse all

Angle, returned as a numeric scalar in the range [0, 180] degrees.

Data Types: double


To understand how imdistline calculates the angle returned by getAngleToHorizontal, draw an imaginary horizontal vector from the bottom endpoint of the distance line, extending to the right. The value returned by getAngleToHorizontal is the angle from this horizontal vector to the distance line, which can range from 0 to 180 degrees.

Version History

Introduced before R2006a

See Also