Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
3223d275
Commit
3223d275
authored
Jun 23, 2018
by
LEFEBVREJP email
Browse files
Merge branch 'marching-squares-bug' into 'master'
Fixing states 5 and 10 to ensure clock-wise walk. See merge request
!40
parents
2f73167c
3e696274
Pipeline
#13844
failed with stages
in 7 minutes and 5 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixalgorithm/marchingsquares.i.hh
View file @
3223d275
...
@@ -97,8 +97,6 @@ std::vector<std::pair<int, int>> MarchingSquares<data_type>::march(
...
@@ -97,8 +97,6 @@ std::vector<std::pair<int, int>> MarchingSquares<data_type>::march(
// of rows and columns to allow for traveling the boundaries
// of rows and columns to allow for traveling the boundaries
if
(
column
>=
0
&&
column
<=
mColumns
&&
row
>=
0
&&
row
<=
mRows
)
if
(
column
>=
0
&&
column
<=
mColumns
&&
row
>=
0
&&
row
<=
mRows
)
{
{
radix_tagged_line
(
"("
<<
row
<<
", "
<<
column
<<
") ="
<<
int
(
next_step
));
out
.
push_back
({
row
,
column
});
out
.
push_back
({
row
,
column
});
}
}
...
@@ -206,10 +204,7 @@ void MarchingSquares<data_type>::step(size_t r, size_t c)
...
@@ -206,10 +204,7 @@ void MarchingSquares<data_type>::step(size_t r, size_t c)
next_step
=
StepDirection
::
Left
;
next_step
=
StepDirection
::
Left
;
break
;
break
;
case
2
:
case
2
:
if
(
prev_step
==
StepDirection
::
Left
)
next_step
=
StepDirection
::
Up
;
next_step
=
StepDirection
::
Up
;
else
next_step
=
StepDirection
::
Right
;
break
;
break
;
case
3
:
case
3
:
next_step
=
StepDirection
::
Left
;
next_step
=
StepDirection
::
Left
;
...
@@ -218,57 +213,54 @@ void MarchingSquares<data_type>::step(size_t r, size_t c)
...
@@ -218,57 +213,54 @@ void MarchingSquares<data_type>::step(size_t r, size_t c)
next_step
=
StepDirection
::
Right
;
next_step
=
StepDirection
::
Right
;
break
;
break
;
case
5
:
case
5
:
next_step
=
StepDirection
::
Up
;
break
;
case
6
:
if
(
prev_step
==
StepDirection
::
Down
)
if
(
prev_step
==
StepDirection
::
Down
)
next_step
=
StepDirection
::
Down
;
next_step
=
StepDirection
::
Right
;
else
else
next_step
=
StepDirection
::
Up
;
next_step
=
StepDirection
::
Left
;
break
;
case
6
:
next_step
=
StepDirection
::
Up
;
break
;
break
;
case
7
:
case
7
:
if
(
prev_step
==
StepDirection
::
Up
)
next_step
=
StepDirection
::
Left
;
next_step
=
StepDirection
::
Left
;
else
next_step
=
StepDirection
::
Down
;
break
;
break
;
case
8
:
case
8
:
next_step
=
StepDirection
::
Down
;
next_step
=
StepDirection
::
Down
;
break
;
break
;
case
9
:
case
9
:
if
(
prev_step
==
StepDirection
::
Down
)
next_step
=
StepDirection
::
Down
;
else
next_step
=
StepDirection
::
Up
;
break
;
case
10
:
next_step
=
StepDirection
::
Down
;
next_step
=
StepDirection
::
Down
;
break
;
break
;
case
1
1
:
case
1
0
:
if
(
prev_step
==
StepDirection
::
Left
)
if
(
prev_step
==
StepDirection
::
Left
)
next_step
=
StepDirection
::
Down
;
next_step
=
StepDirection
::
Down
;
else
else
next_step
=
StepDirection
::
Right
;
next_step
=
StepDirection
::
Up
;
break
;
case
11
:
next_step
=
StepDirection
::
Down
;
break
;
break
;
case
12
:
case
12
:
next_step
=
StepDirection
::
Right
;
next_step
=
StepDirection
::
Right
;
break
;
break
;
case
13
:
case
13
:
if
(
prev_step
==
StepDirection
::
Down
)
next_step
=
StepDirection
::
Right
;
next_step
=
StepDirection
::
Right
;
else
next_step
==
StepDirection
::
Up
;
break
;
break
;
case
14
:
case
14
:
if
(
prev_step
==
StepDirection
::
Down
)
next_step
=
StepDirection
::
Up
;
next_step
=
StepDirection
::
Left
;
else
next_step
=
StepDirection
::
Up
;
break
;
break
;
default:
default:
next_step
=
StepDirection
::
None
;
next_step
=
StepDirection
::
None
;
break
;
break
;
}
}
radix_tagged_line
(
"("
<<
r
<<
", "
<<
c
<<
") ="
<<
state
<<
" "
<<
((
next_step
==
StepDirection
::
Up
)
?
"Up"
:
((
next_step
==
StepDirection
::
Down
)
?
"Down"
:
(
next_step
==
StepDirection
::
Left
)
?
"Left"
:
"Right"
)));
}
}
}
// namespace radix
}
// namespace radix
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment