Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
8650fa0a
Verified
Commit
8650fa0a
authored
Jun 12, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Resolve segfault when not square matrix
parent
e59b56a0
Pipeline
#79714
passed with stage
in 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/voisinage.cpp
View file @
8650fa0a
...
...
@@ -14,10 +14,10 @@ void RegleVoisinageNeumann::calculVoisinage(Voisinage& v, const Reseau& r) const
for
(
int
j
=
-
static_cast
<
int
>
(
rayon
);
j
<=
static_cast
<
int
>
(
rayon
);
j
++
)
if
(
abs
(
i
)
+
abs
(
j
)
<=
static_cast
<
int
>
(
rayon
)
&&
(
i
!=
0
||
j
!=
0
))
{
int
x
=
(
cellY
+
i
)
%
haut
eur
;
int
x
=
(
cellY
+
i
)
%
larg
eur
;
if
(
x
<
0
)
x
=
largeur
+
x
;
int
y
=
(
cellX
+
j
)
%
larg
eur
;
int
y
=
(
cellX
+
j
)
%
haut
eur
;
if
(
y
<
0
)
y
=
hauteur
+
y
;
v
.
voisinage
.
push_back
(
new
Cellule
(
r
.
getReseau
()[
y
][
x
]));
...
...
@@ -35,10 +35,10 @@ void RegleVoisinageMoore::calculVoisinage(Voisinage& v, const Reseau& r) const {
for
(
int
j
=
-
static_cast
<
int
>
(
rayon
);
j
<=
static_cast
<
int
>
(
rayon
);
j
++
)
if
(
i
!=
0
||
j
!=
0
)
{
int
x
=
(
cellY
+
i
)
%
haut
eur
;
int
x
=
(
cellY
+
i
)
%
larg
eur
;
if
(
x
<
0
)
x
=
largeur
+
x
;
int
y
=
(
cellX
+
j
)
%
larg
eur
;
int
y
=
(
cellX
+
j
)
%
haut
eur
;
if
(
y
<
0
)
y
=
hauteur
+
y
;
v
.
voisinage
.
push_back
(
new
Cellule
(
r
.
getReseau
()[
y
][
x
]));
...
...
Write
Preview
Supports
Markdown
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