public static class Boundary2DScanner.Step
extends java.lang.Object
The step of scanning the boundary: moving from one boundary segment to the next boundary segment.
See definition of the "boundary" and "boundary segment" terms in comments to Boundary2DScanner
class.
In fact, this class is an enumeration: there are only 12 immutable instances of this class (all they are created while initialization). Namely:
pixelCenterDX()
, pixelCenterDY()
is ±1, another is 0,
newSide()
==oldSide()
;pixelCenterDX()
==±1, pixelCenterDY()
==±1,
oldSide()
and newSide()
is a pair of adjacent pixel sides;pixelCenterDX()
==0, pixelCenterDY()
==0,
oldSide()
and newSide()
is a pair of adjacent pixel sides.So, you can compare instances of this class by == operator, as well as enumeration instances.
You can also identify instances of this class with help of a unique code, returned by code()
method.
This class is immutable and threadsafe: there are no ways to modify settings of the created instance.
Modifier and Type  Field and Description 

static double 
DIAGONAL_LENGTH
Equal to StrictMath.sqrt(2.0): the distance between pixel centers for diagonal steps.

static double 
HALF_DIAGONAL_LENGTH
Equal to 0.5 * StrictMath.sqrt(2.0): the distance between segment centers for diagonal steps
and movements around the same pixel.

static int 
ROTATION_X_MINUS_TO_Y_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = 0,
oldSide() = Side.X_MINUS ,
newSide() = Side.Y_MINUS . 
static int 
ROTATION_X_PLUS_TO_Y_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = 0,
oldSide() = Side.X_PLUS ,
newSide() = Side.Y_PLUS . 
static int 
ROTATION_Y_MINUS_TO_X_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = 0,
oldSide() = Side.Y_MINUS ,
newSide() = Side.X_PLUS . 
static int 
ROTATION_Y_PLUS_TO_X_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = 0,
oldSide() = Side.Y_PLUS ,
newSide() = Side.X_MINUS . 
static int 
X_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = −1,
pixelCenterDY() = 0,
oldSide() = Side.Y_PLUS ,
newSide() = Side.Y_PLUS . 
static int 
X_MINUS_Y_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = −1,
pixelCenterDY() = −1,
oldSide() = Side.X_MINUS ,
newSide() = Side.Y_PLUS . 
static int 
X_MINUS_Y_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = −1,
pixelCenterDY() = +1,
oldSide() = Side.Y_PLUS ,
newSide() = Side.X_PLUS . 
static int 
X_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = +1,
pixelCenterDY() = 0,
oldSide() = Side.Y_MINUS ,
newSide() = Side.Y_MINUS . 
static int 
X_PLUS_Y_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = +1,
pixelCenterDY() = −1,
oldSide() = Side.Y_MINUS ,
newSide() = Side.X_MINUS . 
static int 
X_PLUS_Y_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = +1,
pixelCenterDY() = +1,
oldSide() = Side.X_PLUS ,
newSide() = Side.Y_MINUS . 
static int 
Y_MINUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = −1,
oldSide() = Side.X_MINUS ,
newSide() = Side.X_MINUS . 
static int 
Y_PLUS_CODE
Result of
code() method for the following scanning step:
pixelCenterDX() = 0,
pixelCenterDY() = +1,
oldSide() = Side.X_PLUS ,
newSide() = Side.X_PLUS . 
Modifier and Type  Method and Description 

int 
code()
Returns integer unique code from 0 to 11, identifying this step.

double 
distanceBetweenPixelCenters()
Returns the distance between the centers of the previous and current pixel;
equal to StrictMath.hypot(
pixelCenterDX() , pixelCenterDY() ). 
double 
distanceBetweenSegmentCenters()
Returns the distance between the centers of the previous and current boundary segments.

boolean 
isDiagonal()
Returns true if
pixelCenterDX() !=0 && pixelCenterDY() !=0. 
boolean 
isHorizontal()
Returns true if
pixelCenterDX() is ±1 and pixelCenterDY() is 0. 
boolean 
isSamePixel()
Returns true if
pixelCenterDX() ==0 && pixelCenterDY() ==0. 
boolean 
isStraight()
Returns true if one of
pixelCenterDX() and pixelCenterDY() values is ±1, but another is 0. 
boolean 
isVertical()
Returns true if
pixelCenterDY() is ±1 and pixelCenterDX() is 0. 
Boundary2DScanner.Side 
newSide()
Returns the new (current) pixel side.

Boundary2DScanner.Side 
oldSide()
Returns the previous pixel side.

int 
pixelCenterDX()
Returns change of xcoordinate of the pixel center, performed by this step.

int 
pixelCenterDY()
Returns change of ycoordinate of the pixel center, performed by this step.

double 
pixelVertexX()
Returns xcoordinate of the vertex of the new (current) pixel,
which is common for the current and previous segments (pixel sides),
on the assumption that the center of the new (current) pixel is at the origin of coordinates.

double 
pixelVertexY()
Returns ycoordinate of the vertex of the new (current) pixel,
which is common for the current and previous segments (pixel sides),
on the assumption that the center of the new (current) pixel is at the origin of coordinates.

double 
segmentCenterDX()
Returns change of xcoordinate of the center of the current boundary segment,
performed by this step.

double 
segmentCenterDY()
Returns change of ycoordinate of the center of the current boundary segment,
performed by this step.

java.lang.String 
toString()
Returns a brief string description of this object.

public static final int Y_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= −1,
oldSide()
= Side.X_MINUS
,
newSide()
= Side.X_MINUS
.
It is shown below:
↑ ↑
public static final int X_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= +1,
pixelCenterDY()
= 0,
oldSide()
= Side.Y_MINUS
,
newSide()
= Side.Y_MINUS
.
It is shown below:
→ →
public static final int Y_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= +1,
oldSide()
= Side.X_PLUS
,
newSide()
= Side.X_PLUS
.
It is shown below:
↓ ↓
public static final int X_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= −1,
pixelCenterDY()
= 0,
oldSide()
= Side.Y_PLUS
,
newSide()
= Side.Y_PLUS
.
It is shown below:
← ←
public static final int X_MINUS_Y_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= −1,
pixelCenterDY()
= −1,
oldSide()
= Side.X_MINUS
,
newSide()
= Side.Y_PLUS
.
It is shown below:
← ↑
public static final int X_PLUS_Y_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= +1,
pixelCenterDY()
= −1,
oldSide()
= Side.Y_MINUS
,
newSide()
= Side.X_MINUS
.
It is shown below:
↑ →
public static final int X_PLUS_Y_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= +1,
pixelCenterDY()
= +1,
oldSide()
= Side.X_PLUS
,
newSide()
= Side.Y_MINUS
.
It is shown below:
↓ →
public static final int X_MINUS_Y_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= −1,
pixelCenterDY()
= +1,
oldSide()
= Side.Y_PLUS
,
newSide()
= Side.X_PLUS
.
It is shown below:
← ↓
public static final int ROTATION_X_MINUS_TO_Y_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= 0,
oldSide()
= Side.X_MINUS
,
newSide()
= Side.Y_MINUS
.
It is shown below:
→ ↑
public static final int ROTATION_Y_MINUS_TO_X_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= 0,
oldSide()
= Side.Y_MINUS
,
newSide()
= Side.X_PLUS
.
It is shown below:
→ ↓
public static final int ROTATION_X_PLUS_TO_Y_PLUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= 0,
oldSide()
= Side.X_PLUS
,
newSide()
= Side.Y_PLUS
.
It is shown below:
↓ ←
public static final int ROTATION_Y_PLUS_TO_X_MINUS_CODE
code()
method for the following scanning step:
pixelCenterDX()
= 0,
pixelCenterDY()
= 0,
oldSide()
= Side.Y_PLUS
,
newSide()
= Side.X_MINUS
.
It is shown below:
↑ ←
public static final double DIAGONAL_LENGTH
distanceBetweenPixelCenters()
.public static final double HALF_DIAGONAL_LENGTH
public int code()
This method returns one of the following constants:
Y_PLUS_CODE
,X_PLUS_CODE
,Y_MINUS_CODE
,X_MINUS_CODE
,X_MINUS_Y_MINUS_CODE
,X_PLUS_Y_MINUS_CODE
,X_PLUS_Y_PLUS_CODE
,X_MINUS_Y_PLUS_CODE
,ROTATION_X_MINUS_TO_Y_MINUS_CODE
,ROTATION_Y_MINUS_TO_X_PLUS_CODE
,ROTATION_X_PLUS_TO_Y_PLUS_CODE
,ROTATION_Y_PLUS_TO_X_MINUS_CODE
.You can use this value for maximally efficient switching, depending on the step kind, using Java switch operator.
public int pixelCenterDX()
current position
along xaxis.
Works very quickly (this method just returns an internal field).Boundary2DScanner.x()
public int pixelCenterDY()
current position
along yaxis.
Works very quickly (this method just returns an internal field).Boundary2DScanner.y()
public double segmentCenterDX()
Boundary2DScanner.Side.centerX()
public double segmentCenterDY()
Boundary2DScanner.Side.centerY()
public double pixelVertexX()
public double pixelVertexY()
public boolean isSamePixel()
pixelCenterDX()
==0 && pixelCenterDY()
==0.
Works very quickly (this method just returns an internal field).pixelCenterDX()
==0 && pixelCenterDY()
==0.public boolean isHorizontal()
pixelCenterDX()
is ±1 and pixelCenterDY()
is 0.
Works very quickly (this method just returns an internal field).pixelCenterDX()
!=0 && pixelCenterDY()
==0.public boolean isVertical()
pixelCenterDY()
is ±1 and pixelCenterDX()
is 0.
Works very quickly (this method just returns an internal field).pixelCenterDX()
==0 && pixelCenterDY()
!=0.public boolean isStraight()
pixelCenterDX()
and pixelCenterDY()
values is ±1, but another is 0.
Works very quickly (this method just returns an internal field).isHorizontal()
 isVertical()
.public boolean isDiagonal()
pixelCenterDX()
!=0 && pixelCenterDY()
!=0.
Works very quickly (this method just returns an internal field).pixelCenterDX()
!=0 && pixelCenterDY()
!=0.public double distanceBetweenPixelCenters()
pixelCenterDX()
, pixelCenterDY()
).
In other words, returns 0 if isSamePixel()
, 1 for straight steps and
DIAGONAL_LENGTH
=√2 for diagonal steps.
Works very quickly (this method just returns an internal field).public double distanceBetweenSegmentCenters()
HALF_DIAGONAL_LENGTH
=0.5*√2 for diagonal steps and for movements around the same pixel.
Works very quickly (this method just returns an internal field).public Boundary2DScanner.Side oldSide()
public Boundary2DScanner.Side newSide()
public java.lang.String toString()
The result of this method may depend on implementation.
toString
in class java.lang.Object
Медицинские курсы без медицинского образования  правила приема Медицинские курсы без медицинского образования  правила приема на первый курс. kareristka.ru 