Enum Class ContourLineType

java.lang.Object
java.lang.Enum<ContourLineType>
net.algart.matrices.scanning.ContourLineType
All Implemented Interfaces:
Serializable, Comparable<ContourLineType>, Constable

public enum ContourLineType extends Enum<ContourLineType>

Contour line style for 2-dimensional object boundaries, traced by Boundary2DScanner. Used by some classes that measure parameters of 2-dimensional objects on the base of their boundaries, like the length of the perimeter, the area, the projections, etc. For example, it is used while creating Boundary2DSimpleMeasurer and Boundary2DProjectionMeasurer.

Please note: this enum may be extended in future versions with new contour styles (for example, rounded or curve). So, if your application chooses behaviour depending on a switch of this type, please always provide a special branch for a case of new future contour types, unknown yet. (It can be default case for Java switch operator.) It is a good idea to throw UnsupportedOperationException in such a branch.

This class is immutable and thread-safe: there are no ways to modify settings of the created instance.

Author:
Daniel Alievsky
  • Enum Constant Details

    • STRICT_BOUNDARY

      public static final ContourLineType STRICT_BOUNDARY
      Style, for which it is considered that the contour is identical to the boundary. Such contour consists of 1-pixel segments, separating object pixels (unit matrix elements) from the free space (zero matrix elements). In this case, for example, if an object consists of only 1 pixel (a square with the side 1.0), the contour line consists of 4 segments of the length 1.0 — sides of this square, and the length of contour is 4.0.
    • PIXEL_CENTERS_POLYLINE

      public static final ContourLineType PIXEL_CENTERS_POLYLINE
      Style, for which it is considered that the contour is a polyline, connecting centers of all pixels, visited by scanBoundary method (boundary pixels of an object). Such contour consists of segments with the length 1.0 and √2, lying inside an object at the little distance from its boundary (not farther than 0.5). In this case, for example, if an object consists of only 1 pixel (a square with the side 1.0), the contour line is empty (degenerated to a point).
    • SEGMENT_CENTERS_POLYLINE

      public static final ContourLineType SEGMENT_CENTERS_POLYLINE
      Style, for which it is considered that the contour is a polyline, connecting centers of all boundary segments, visited by scanBoundary method. Such contour consists of segments with the length 1.0 and 0.5*√2, lying almost at the boundary of an object (sometimes little inside, sometimes little outside). In this case, for example, if an object consists of only 1 pixel (a square with the side 1.0), the contour line consists of 4 segments of the length 0.5*√2, connecting centers of the sides of this square, and the length of contour is 2*√2.
  • Method Details