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
7876 : 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 |
7997 std::vector<Point2d_<FPT>> v_pts;
7998 for(
const auto& elem: v_coord )
8000 auto id_x = elem.first;
8001 auto id_y = elem.second;
8002 assert( id_x<4 && id_y<4 );
8004 auto pt = Point2d_<FPT>( v_x[id_x]._value, v_y[id_y]._value );
8006 v_pts.push_back(
pt );
8009 if( v_pts.back() !=
pt && v_pts.front() !=
pt )
8010 v_pts.push_back(
pt );
8014 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 |
7917 case Direction::N: row--;
break;
7918 case Direction::S: row++;
break;
7919 case Direction::E: col++;
break;
7920 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
7932 bool firstTime =
true;
7937 std::vector<PCoord> out;
7940 if( table[row][col]._isCorner )
7942 auto new_pair = std::make_pair(row,col);
7943 if( out.size() > 0 )
7944 if( new_pair == out.front() && out.size() > 2 )
7947 out.push_back( new_pair );
7951 dir =
turn( dir, Turn::Right );
7955 if( ( row==2 || row==1 ) && ( col==2 || col==1 ) )
7957 out.push_back( std::make_pair(row,col) );
7958 dir =
turn( dir, Turn::Left );
Direction turn(Direction dir, Turn turn)
Definition: homog2d.hpp:7895
void moveToNextCell(uint8_t &row, uint8_t &col, const Direction &dir)
Definition: homog2d.hpp:7913
Direction
Definition: homog2d.hpp:7876
◆ turn()
7900 return turn == Turn::Left ? Direction::S : Direction::N;
7902 return turn == Turn::Left ? Direction::E : Direction::W;
7904 return turn == Turn::Left ? Direction::N : Direction::S;
7906 return turn == Turn::Left ? Direction::W : Direction::E;
7908 return Direction::N;
Direction turn(Direction dir, Turn turn)
Definition: homog2d.hpp:7895