Enum Class Boundary2DScanner.Side

java.lang.Object
java.lang.Enum<Boundary2DScanner.Side>
net.algart.matrices.scanning.Boundary2DScanner.Side
All Implemented Interfaces:
Serializable, Comparable<Boundary2DScanner.Side>, Constable
Enclosing class:
Boundary2DScanner

public static enum Boundary2DScanner.Side extends Enum<Boundary2DScanner.Side>

The pixel side. This class represents one of 4 sides of a pixel (little square 1x1). See definition of the "pixel" term in comments to Boundary2DScanner class.

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

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The left side (if the x axis is directed rightwards): the vertical boundary segment of the pixel with less x-coordinate.
    The right side (if the x axis is directed rightwards): the vertical boundary segment of the pixel with greater x-coordinate.
    The top side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with less y-coordinate.
    The bottom side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with greater y-coordinate.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns x-coordinate of the center (middle) of this side of the pixel.
    double
    Returns y-coordinate of the center (middle) of this side of the pixel.
    int
    Returns x-projection of this side of the pixel; the side is considered as an oriented segment (vector).
    int
    Returns y-projection of this side of the pixel; the side is considered as an oriented segment (vector).
    boolean
    Returns true for Y_MINUS and Y_PLUS, false for X_MINUS and X_PLUS;
    boolean
    Returns true for X_MINUS and X_PLUS, false for Y_MINUS and Y_PLUS;
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • X_MINUS

      public static final Boundary2DScanner.Side X_MINUS
      The left side (if the x axis is directed rightwards): the vertical boundary segment of the pixel with less x-coordinate.
    • Y_MINUS

      public static final Boundary2DScanner.Side Y_MINUS
      The top side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with less y-coordinate.
    • X_PLUS

      public static final Boundary2DScanner.Side X_PLUS
      The right side (if the x axis is directed rightwards): the vertical boundary segment of the pixel with greater x-coordinate.
    • Y_PLUS

      public static final Boundary2DScanner.Side Y_PLUS
      The bottom side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with greater y-coordinate.
  • Method Details

    • values

      public static Boundary2DScanner.Side[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Boundary2DScanner.Side valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isHorizontal

      public boolean isHorizontal()
      Returns true for Y_MINUS and Y_PLUS, false for X_MINUS and X_PLUS;
      Returns:
      whether it is a horizontal side of the square pixel.
    • isVertical

      public boolean isVertical()
      Returns true for X_MINUS and X_PLUS, false for Y_MINUS and Y_PLUS;
      Returns:
      whether it is a vertical side of the square pixel.
    • dxAlong

      public int dxAlong()
      Returns x-projection of this side of the pixel; the side is considered as an oriented segment (vector). It is supposed that we are passing around the pixel in the clockwise order, in assumption that if the x axis is directed rightwards and the y axis is directed downwards, — according to the general rules of tracing boundary segments, specified in comments to Boundary2DScanner class.

      This method returns +1 for Y_MINUS, -1 for Y_PLUS, 0 for X_MINUS and X_PLUS.

      Returns:
      x-projection of this side of the pixel.
    • dyAlong

      public int dyAlong()
      Returns y-projection of this side of the pixel; the side is considered as an oriented segment (vector). It is supposed that we are passing around the pixel in the clockwise order, in assumption that if the x axis is directed rightwards and the y axis is directed downwards, — according to the general rules of tracing boundary segments, specified in comments to Boundary2DScanner class.

      This method returns -1 for X_MINUS, +1 for X_PLUS, 0 for Y_MINUS and Y_PLUS.

      Returns:
      y-projection of this side of the pixel.
    • centerX

      public double centerX()
      Returns x-coordinate of the center (middle) of this side of the pixel. (It is supposed that the center of this pixel is at the origin of coordinates.)

      This method returns -0.5 for X_MINUS, +0.5 for X_PLUS, 0.0 for Y_MINUS and Y_PLUS.

      Returns:
      x-coordinate of the center of this pixel side.
    • centerY

      public double centerY()
      Returns y-coordinate of the center (middle) of this side of the pixel. (It is supposed that the center of this pixel is at the origin of coordinates.)

      This method returns -0.5 for Y_MINUS, +0.5 for Y_PLUS, 0.0 for X_MINUS and X_PLUS.

      Returns:
      x-coordinate of the center of this pixel side.