Common stuff for FRect_ union, see FRect_::unionArea()
More...
|
struct | Cell |
| A wrapper around a bool, that gets set if that point defined by indexes ix and iy is a corner in the table. More...
|
|
struct | Index |
| Holds x or y coordinate value of rectangle during computation of intersection area. More...
|
|
|
using | PCoord = std::pair< uint8_t, uint8_t > |
|
using | Table = std::array< std::array< Cell, 4 >, 4 > |
|
Common stuff for FRect_ union, see FRect_::unionArea()
◆ PCoord
◆ Table
◆ Direction
7875 : uint8_t {
N,
E,
S,
W };
◆ Turn
◆ convertToCoord()
template<typename FPT >
CPolyline_<FPT> h2d::priv::runion::convertToCoord |
( |
const std::vector< PCoord > & |
v_coord, |
|
|
const std::array< Index< FPT >, 4 > & |
v_x, |
|
|
const std::array< Index< FPT >, 4 > & |
v_y |
|
) |
| |
|
inline |
Helper function, used in FRect_<FPT>::unionArea()
- Parameters
-
v_coord | vector of coordinate indexes |
v_x | holds x-coordinates |
v_y | holds y-coordinates |
7996 std::vector<Point2d_<FPT>> v_pts;
7997 for(
const auto& elem: v_coord )
7999 auto id_x = elem.first;
8000 auto id_y = elem.second;
8001 assert( id_x<4 && id_y<4 );
8003 auto pt = Point2d_<FPT>( v_x[id_x]._value, v_y[id_y]._value );
8005 v_pts.push_back(
pt );
8008 if( v_pts.back() !=
pt && v_pts.front() !=
pt )
8009 v_pts.push_back(
pt );
8013 return CPolyline_<FPT>( v_pts );
Point2d pt
Definition: homog2d_test.cpp:4034
◆ moveToNextCell()
void h2d::priv::runion::moveToNextCell |
( |
uint8_t & |
row, |
|
|
uint8_t & |
col, |
|
|
const Direction & |
dir |
|
) |
| |
|
inline |
7916 case Direction::N: row--;
break;
7917 case Direction::S: row++;
break;
7918 case Direction::E: col++;
break;
7919 case Direction::W: col--;
break;
◆ parseTable()
std::vector<PCoord> h2d::priv::runion::parseTable |
( |
Table & |
table | ) |
|
|
inline |
Helper function for FRect_<FPT>::unionArea()
- Start from 0,0, direction East
7931 bool firstTime =
true;
7936 std::vector<PCoord> out;
7939 if( table[row][col]._isCorner )
7941 auto new_pair = std::make_pair(row,col);
7942 if( out.size() > 0 )
7943 if( new_pair == out.front() && out.size() > 2 )
7946 out.push_back( new_pair );
7950 dir =
turn( dir, Turn::Right );
7954 if( ( row==2 || row==1 ) && ( col==2 || col==1 ) )
7956 out.push_back( std::make_pair(row,col) );
7957 dir =
turn( dir, Turn::Left );
Direction turn(Direction dir, Turn turn)
Definition: homog2d.hpp:7894
void moveToNextCell(uint8_t &row, uint8_t &col, const Direction &dir)
Definition: homog2d.hpp:7912
Direction
Definition: homog2d.hpp:7875
◆ turn()
7899 return turn == Turn::Left ? Direction::S : Direction::N;
7901 return turn == Turn::Left ? Direction::E : Direction::W;
7903 return turn == Turn::Left ? Direction::N : Direction::S;
7905 return turn == Turn::Left ? Direction::W : Direction::E;
7907 return Direction::N;
Direction turn(Direction dir, Turn turn)
Definition: homog2d.hpp:7894