
for (int index = 1; index < line_arr.length - 2; ++index)
</BUG>
{
<BUG>PlaDirection d1 = line_arr[index].direction();

PlaDirection d2 = line_arr[index + 1].direction();
</BUG>
if (d1.is_multiple_of_45_degree() && d2.is_multiple_of_45_degree() && d1.projection(d2) != Signum.POSITIVE)
{

boolean polyline_changed = true;
while (polyline_changed)
{
if (p_polyline.plaline_len() < 4) return p_polyline;
polyline_changed = false;
PlaLineIntAlist line_arr = p_polyline.alist_copy(0);
for (int index = 1; index < line_arr.size() - 2; ++index)
{
PlaDirection d1 = line_arr.get(index).direction();
PlaDirection d2 = line_arr.get(index + 1).direction();
if (d1.is_multiple_of_45_degree() && d2.is_multiple_of_45_degree() && d1.projection(d2) != Signum.POSITIVE)
{
