Package net.algart.matrices.scanning
Enum Class Boundary2DScanner.Side
- All Implemented Interfaces:
Serializable
,Comparable<Boundary2DScanner.Side>
,Constable
- Enclosing class:
Boundary2DScanner
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 ConstantDescriptionThe 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 TypeMethodDescriptiondouble
centerX()
Returns x-coordinate of the center (middle) of this side of the pixel.double
centerY()
Returns y-coordinate of the center (middle) of this side of the pixel.int
dxAlong()
Returns x-projection of this side of the pixel; the side is considered as an oriented segment (vector).int
dyAlong()
Returns y-projection of this side of the pixel; the side is considered as an oriented segment (vector).boolean
boolean
static Boundary2DScanner.Side
Returns the enum constant of this class with the specified name.static Boundary2DScanner.Side[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
The top side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with less y-coordinate. -
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
The bottom side (if the y axis is directed downwards): the horizontal boundary segment of the pixel with greater y-coordinate.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
isHorizontal
public boolean isHorizontal()- Returns:
- whether it is a horizontal side of the square pixel.
-
isVertical
public boolean isVertical()- 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 toBoundary2DScanner
class.This method returns +1 for
Y_MINUS
, -1 forY_PLUS
, 0 forX_MINUS
andX_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 toBoundary2DScanner
class.This method returns -1 for
X_MINUS
, +1 forX_PLUS
, 0 forY_MINUS
andY_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 forX_PLUS
, 0.0 forY_MINUS
andY_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 forY_PLUS
, 0.0 forX_MINUS
andX_PLUS
.- Returns:
- x-coordinate of the center of this pixel side.
-