Operators

# elliptic_axis_points_xld (Operator)

## Name

elliptic_axis_points_xld — Parameters of the equivalent ellipse of contours or polygons treated as point clouds.

## Signature

elliptic_axis_points_xld(XLD : : : Ra, Rb, Phi)

## Description

The operator elliptic_axis_points_xld calculates the radii (Ra, Rb) and the orientation (Phi, in radians) of the ellipse having the same orientation and the same aspect ratio as the point cloud given by the contour or polygon XLD (i.e., the order of the points in the contour or polygon is not taken into account). If the contour or polygon is closed (end point = start point), the end point of the contour or polygon is not taken into account to avoid that it receives twice the weight of the other points.

Calculation:

```        If the moments M20, M02 and M11 are
normalized to the area (see moments_points_xld),
calculated as:

Ra = sqrt(8.0*(M20+M02+sqrt((M20-M02)^2+4.0*M11^2)))/2.0
Rb = sqrt(8.0*(M20+M02-sqrt((M20-M02)^2+4.0*M11^2)))/2.0

The orientation Phi, i.e., the angle between the major axis
and the x (column) axis, is defined by:

Phi = -0.5 * atan2(2.0 * M11,M02 - M20)
```

elliptic_axis_points_xld should be used if the contour XLD intersects itself or if it is not possible to close the contour using a line from end to start point without self-intersection, because in this case elliptic_axis_xld does not produce useful results. To test whether the contours or polygons intersect themselves, test_self_intersection_xld can be used.

If more than one contour or polygon is passed, the results are stored in tuples in the same order as the respective contours or polygons in XLD.

## Parallelization

• Multithreading type: reentrant (runs in parallel with non-exclusive operators).
• Automatically parallelized on tuple level.

## Parameters

XLD (input_object)  xld(-array) object

Contours or polygons to be examined.

Ra (output_control)  real(-array) (real)

Assertion: Ra >= 0.0

Rb (output_control)  real(-array) (real)

Assertion: Rb >= 0.0 && Rb <= Ra

Phi (output_control)  real(-array) (real)

Angle between the major axis and the column axis (radians).

Assertion: - pi / 2 < Phi && Phi <= pi / 2

## Complexity

Let n be the number of points of the contour or polygon. Then the run time is O(n).

## Result

elliptic_axis_points_xld returns 2 (H_MSG_TRUE) if the input is not empty. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.