mirror of https://github.com/CGAL/cgal
continue l-shape
This commit is contained in:
parent
d3f1a4c703
commit
3b5bb69a29
|
|
@ -346,6 +346,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simplify the path by removing all brackets
|
||||||
bool bracket_flattening()
|
bool bracket_flattening()
|
||||||
{
|
{
|
||||||
bool res=false;
|
bool res=false;
|
||||||
|
|
@ -381,6 +382,7 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simplify the path by removing all spurs
|
||||||
bool remove_spurs()
|
bool remove_spurs()
|
||||||
{
|
{
|
||||||
bool res=false;
|
bool res=false;
|
||||||
|
|
@ -389,38 +391,43 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simplify the path by removing all possible brackets and spurs
|
||||||
|
|
||||||
|
void simplify()
|
||||||
|
{
|
||||||
|
bool modified=false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
modified=bracket_flattening_one_step();
|
||||||
|
if (!modified)
|
||||||
|
{ modified=remove_spurs_one_step(); }
|
||||||
|
}
|
||||||
|
while(modified);
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t find_l_shape(std::size_t begin) const
|
std::size_t find_l_shape(std::size_t begin) const
|
||||||
{
|
{
|
||||||
assert(next_turn(begin)!=2);
|
assert(next_turn(begin)==2);
|
||||||
std::size_t end=begin+1;
|
std::size_t end=begin+1;
|
||||||
if (end==m_path.size()-1 && !is_closed())
|
if (end==m_path.size()-1 && !is_closed())
|
||||||
{ return begin; } // begin is the before last dart
|
{ return begin; } // begin is the before last dart
|
||||||
|
|
||||||
while (next_turn(end)==2 && end!=begin)
|
while (next_turn(end)==2 && end!=begin)
|
||||||
{
|
{ end=next_index(end); }
|
||||||
++end;
|
|
||||||
if (is_closed() && end==m_path.size()) { end=0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (begin==end)
|
if (begin==end)
|
||||||
{ // Case of a path having only 2 turns
|
{ // Case of a path having only 2 turns
|
||||||
// TODO SOMETHING
|
|
||||||
std::cout<<"TODO TODO !!"<<std::endl;
|
std::cout<<"TODO TODO !!"<<std::endl;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_turn(end)==1)
|
if (next_turn(end)==1)
|
||||||
{
|
{ end=next_index(end); }
|
||||||
++end;
|
|
||||||
if (is_closed() && end==m_path.size()) { end=0; }
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{ return begin; }
|
{ return begin; }
|
||||||
|
|
||||||
while (next_turn(end)==2)
|
while (next_turn(end)==2)
|
||||||
{
|
{ end=next_index(end); }
|
||||||
++end;
|
|
||||||
if (is_closed() && end==m_path.size()) { end=0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue