Package net.algart.matrices.scanning
Enum Class ConnectivityType
- All Implemented Interfaces:
Serializable
,Comparable<ConnectivityType>
,Constable
Connectivity kind of connected objects in the matrix.
Used by ConnectedObjectScanner
and Boundary2DScanner
classes.
See definition of this term in comments to ConnectedObjectScanner
.
This class is immutable and thread-safe: there are no ways to modify settings of the created instance.
- Author:
- Daniel Alievsky
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionStraight-and-diagonal connectivity.Straight connectivity. -
Method Summary
Modifier and TypeMethodDescriptionint
numberOfNeighbours
(int dimCount) Returns the number of neighbours of any matrix element: 2*dimCount forstraight connectivity
, 3dimCount-1 forstraight-and-diagonal connectivity
.static ConnectivityType
Returns the enum constant of this class with the specified name.static ConnectivityType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STRAIGHT_ONLY
Straight connectivity. Two unit elements with coordinatesi0, i1, ..., in-1 andj0, j1, ..., jn-1 are neighbours and, so, connected with each other if one from the coordinates differs by 1, but all other coordinates are equal:∑ |ik−jk|=1
For 2D matrices, this connectivity kind is also known as "4-connectivity".
-
STRAIGHT_AND_DIAGONAL
Straight-and-diagonal connectivity. Two unit elements with coordinatesi0, i1, ..., in-1 andj0, j1, ..., jn-1 are neighbours and, so, connected with each other if several (at least one) from their coordinates differ by 1 and all other coordinates are equal:max (|ik−jk|)=1
For 2D matrices, this connectivity kind is also known as "8-connectivity".
-
-
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
-
numberOfNeighbours
public int numberOfNeighbours(int dimCount) Returns the number of neighbours of any matrix element: 2*dimCount forstraight connectivity
, 3dimCount-1 forstraight-and-diagonal connectivity
.- Parameters:
dimCount
- the number of dimensions of the matrix.- Returns:
- the number of neighbours of any matrix element.
- Throws:
IllegalArgumentException
- if dimCount<=0 or dimCount>Matrix.MAX_DIM_COUNT_FOR_SOME_ALGORITHMS
-