[ VIGRA Homepage |
Class Index |
Function Index |
File Index |
Main Page ]
|
NeighborCode Class Reference
|
 |
Encapsulation of direction management for 4-neighborhood.
More...
#include "vigra/pixelneighborhood.hxx"
Encapsulation of direction management for 4-neighborhood.
This helper class allows the transformation between Freeman chain codes (East = 0, North = 1 etc.) and the corresponding Diff2D instances and back.
You can either use the chain codes by explicit qualification:
FourNeighborhood::NeighborCode::Direction d = FourNeighborhood::NeighborCode::East;
FourNeighborCode::Direction d = FourNeighborCode::East;
FourNeighborhood::Direction d = FourNeighborhood::East;
or you can fix 4-neighborhood by importing the entire namespace in your function:
If you want to pass 4-neighborhood codes as a template parameter, use the class FourNeighborhood::NeighborCode.
#include "vigra/pixelneighborhood.hxx"
Namespace: vigra::FourNeighborhood
Member Enumeration Documentation
|
Freeman direction codes for 4-neighborhood. East = 0, North = 1 etc. DirectionCount may be used for portable loop termination conditions. - Enumeration values:
-
Error |
|
East |
|
North |
|
West |
|
South |
|
DirectionCount |
|
|
Member Function Documentation
Diff2D const& bottom |
( |
|
) |
[inline, static] |
|
|
Offset to the bottom neighbor |
|
Transform Diff2D offset into corresponding direction code. The code Direction::Error will be returned if diff is not in the 4-neighborhood. |
Diff2D const& diff |
( |
int |
code |
) |
[inline, static] |
|
|
Equivalent to diff(static_cast<Direction>(code)) . (note: there is no bounds checking on the code you pass.) |
|
Transform direction code into corresponding Diff2D offset. (note: there is no bounds checking on the code you pass.) |
int dX |
( |
int |
code |
) |
[inline, static] |
|
int dY |
( |
int |
code |
) |
[inline, static] |
|
Diff2D const& east |
( |
|
) |
[inline, static] |
|
|
Offset to the east neighbor |
bool isDiagonal |
( |
Direction |
|
) |
[inline, static] |
|
|
Check whether a code refers to a diagonal direction. Useful if you want to abstract the differences between 4- and 8-neighborhood. Always false for 4-neighborhood. |
Diff2D const& left |
( |
|
) |
[inline, static] |
|
|
Offset to the left neighbor |
Diff2D const& north |
( |
|
) |
[inline, static] |
|
|
Offset to the north neighbor |
Diff2D const& relativeDiff |
( |
int |
fromCode, |
|
|
int |
toCode |
|
) |
[inline, static] |
|
|
Equivalent to relativeDiff(static_cast<Direction>(fromCode), static_cast<Direction>(toCode)). (note: there is no bounds checking on the code you pass.) |
|
Get the relative offset from one neighbor to the other. For example, relativeDiff(East, West) == Diff2D(-2,0) . (note: there is no bounds checking on the code you pass.) |
Diff2D const& right |
( |
|
) |
[inline, static] |
|
|
Offset to the right neighbor |
Diff2D const& south |
( |
|
) |
[inline, static] |
|
|
Offset to the south neighbor |
Diff2D const& top |
( |
|
) |
[inline, static] |
|
|
Offset to the top neighbor |
Diff2D const& west |
( |
|
) |
[inline, static] |
|
|
Offset to the west neighbor |
The documentation for this class was generated from the following file: