Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProMod3
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
ProMod3
Commits
068e8e8b
Commit
068e8e8b
authored
6 years ago
by
Studer Gabriel
Browse files
Options
Downloads
Patches
Plain Diff
simplify
parent
d276f08c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/dynamic_spatial_organizer.hh
+13
-23
13 additions, 23 deletions
core/src/dynamic_spatial_organizer.hh
with
13 additions
and
23 deletions
core/src/dynamic_spatial_organizer.hh
+
13
−
23
View file @
068e8e8b
...
@@ -139,6 +139,7 @@ private:
...
@@ -139,6 +139,7 @@ private:
typedef
std
::
map
<
Index
,
SpatialOrganizerCell
<
ITEM
>*>
ItemMap
;
typedef
std
::
map
<
Index
,
SpatialOrganizerCell
<
ITEM
>*>
ItemMap
;
public
:
public
:
DynamicSpatialOrganizer
(
Real
delta
,
DynamicSpatialOrganizer
(
Real
delta
,
...
@@ -161,15 +162,12 @@ public:
...
@@ -161,15 +162,12 @@ public:
}
}
void
Add
(
ITEM
*
item
,
const
geom
::
Vec3
&
pos
)
{
void
Add
(
ITEM
*
item
,
const
geom
::
Vec3
&
pos
)
{
Index
indx
=
gen_index
(
pos
);
Index
indx
=
gen_index
(
pos
);
typename
ItemMap
::
iterator
it
=
map_
.
find
(
indx
);
typename
ItemMap
::
iterator
it
=
map_
.
find
(
indx
);
if
(
it
==
map_
.
end
())
{
if
(
it
==
map_
.
end
())
{
map_
[
indx
]
=
new
SpatialOrganizerCell
<
ITEM
>
;
map_
[
indx
]
=
new
SpatialOrganizerCell
<
ITEM
>
;
it
=
map_
.
find
(
indx
);
it
=
map_
.
find
(
indx
);
}
}
it
->
second
->
AddItem
(
item
,
pos
[
0
],
pos
[
1
],
pos
[
2
]);
it
->
second
->
AddItem
(
item
,
pos
[
0
],
pos
[
1
],
pos
[
2
]);
}
}
...
@@ -187,28 +185,20 @@ public:
...
@@ -187,28 +185,20 @@ public:
void
Reset
(
ITEM
*
item
,
const
geom
::
Vec3
&
actual_pos
,
const
geom
::
Vec3
&
new_pos
)
{
void
Reset
(
ITEM
*
item
,
const
geom
::
Vec3
&
actual_pos
,
const
geom
::
Vec3
&
new_pos
)
{
Index
actual_indx
=
gen_index
(
actual_pos
);
Index
actual_indx
=
gen_index
(
actual_pos
);
Index
new_indx
=
gen_index
(
new_pos
);
Index
new_indx
=
gen_index
(
new_pos
);
if
(
actual_indx
!=
new_indx
)
{
typename
ItemMap
::
iterator
i
=
map_
.
find
(
actual_indx
);
typename
ItemMap
::
iterator
i
=
map_
.
find
(
actual_indx
);
if
(
i
==
map_
.
end
())
{
if
(
i
!=
map_
.
end
())
{
throw
promod3
::
Error
(
"Could not find specified item in dynamic spatial organizer!"
);
typename
ItemMap
::
iterator
j
=
map_
.
find
(
new_indx
);
if
(
j
==
map_
.
end
())
{
map_
[
new_indx
]
=
new
SpatialOrganizerCell
<
ITEM
>
;
j
=
map_
.
find
(
new_indx
);
}
i
->
second
->
RemoveItem
(
item
);
j
->
second
->
AddItem
(
item
,
new_pos
[
0
],
new_pos
[
1
],
new_pos
[
2
]);
return
;
}
throw
promod3
::
Error
(
"Could not find specified item in dynamic spatial organizer!"
);
}
}
else
{
if
(
actual_indx
==
new_indx
)
{
typename
ItemMap
::
iterator
i
=
map_
.
find
(
actual_indx
);
i
->
second
->
ResetPos
(
item
,
new_pos
[
0
],
new_pos
[
1
],
new_pos
[
2
]
);
if
(
i
!=
map_
.
end
())
{
}
else
{
i
->
second
->
ResetPos
(
item
,
new_pos
[
0
],
new_pos
[
1
],
new_pos
[
2
]
);
typename
ItemMap
::
iterator
j
=
map_
.
find
(
new_indx
);
}
if
(
j
==
map_
.
end
())
{
else
{
map_
[
new_indx
]
=
new
SpatialOrganizerCell
<
ITEM
>
;
throw
promod3
::
Error
(
"Could not find specified item in dynamic spatial organizer!"
);
j
=
map_
.
find
(
new_indx
);
}
}
i
->
second
->
RemoveItem
(
item
);
j
->
second
->
AddItem
(
item
,
new_pos
[
0
],
new_pos
[
1
],
new_pos
[
2
]);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment