Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
03b28bd9
Commit
03b28bd9
authored
Sep 05, 2018
by
Marion Goedel
Browse files
Update of PedestrianOverlapProcessor Test.
parent
50f9c592
Changes
3
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/projects/dataprocessing/processor/PedestrianOverlapProcessor.java
View file @
03b28bd9
...
...
@@ -34,8 +34,8 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
minDist
=
pedRadius
*
2
;
int
timeStep
=
state
.
getStep
();
for
(
Pedestrian
ped
:
peds
)
{
// get all Pedestrians with at mo
u
st pedRadius*2.5 distance away
// this reduces the amount
au
f overlap test
.
// get all Pedestrians with at most pedRadius*2.5 distance away
// this reduces the amount
o
f overlap test
s
VPoint
pedPos
=
ped
.
getPosition
();
List
<
DynamicElement
>
neighbours
=
getDynElementsAtPosition
(
state
.
getTopography
(),
ped
.
getPosition
(),
pedRadius
*
2.5
);
// collect pedIds and distance of all overlaps for the current ped in the current timestep
...
...
VadereSimulator/tests/org/vadere/simulator/projects/dataprocessing/processor/PedestrianOverlapProcessorTest.java
View file @
03b28bd9
...
...
@@ -34,7 +34,6 @@ public class PedestrianOverlapProcessorTest extends ProcessorTest {
}
@Test
@Ignore
public
void
doUpdateWithTouching
()
throws
Exception
{
((
PedestrianOverlapProcessorTestEnv
)
processorTestEnv
).
touching
();
super
.
doUpdate
();
...
...
VadereSimulator/tests/org/vadere/simulator/projects/dataprocessing/processor/PedestrianOverlapProcessorTestEnv.java
View file @
03b28bd9
...
...
@@ -10,6 +10,8 @@ import org.vadere.state.scenario.Pedestrian;
import
org.vadere.util.geometry.LinkedCellsGrid
;
import
org.vadere.util.geometry.shapes.VPoint
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
...
...
@@ -137,17 +139,27 @@ public class PedestrianOverlapProcessorTestEnv extends ProcessorTestEnv<Timestep
void
verySmallNotOverlapping
()
{
AttributesAgent
a
=
new
AttributesAgent
();
double
distAtAxis
=
a
.
getRadius
()*
2
+
0.001
;
// this should count as overlap
double
vertDistAt45deg
=
2
*
Math
.
sqrt
(
0.5
)*
a
.
getRadius
()
+
0.001
;
double
vertDistAt45deg
=
Math
.
sqrt
(
2
)*
a
.
getRadius
()
+
0.001
;
addMockStates
(
a
.
getRadius
(),
distAtAxis
,
new
VPoint
(
vertDistAt45deg
,
vertDistAt45deg
));
}
void
touching
()
{
AttributesAgent
a
=
new
AttributesAgent
();
double
distAtAxis
=
a
.
getRadius
()*
2
;
// this should count as overlap
double
vertDistAt45deg
=
2
*
Math
.
sqrt
(
0.5
)*
a
.
getRadius
();
double
vertDistAt45deg
=
round
(
Math
.
sqrt
(
2
)*
a
.
getRadius
()
,
16
)
;
addMockStates
(
a
.
getRadius
(),
distAtAxis
,
new
VPoint
(
vertDistAt45deg
,
vertDistAt45deg
));
}
public
static
double
round
(
double
val
,
int
places
){
if
(
places
<
0
)
throw
new
IllegalArgumentException
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
val
);
bigDecimal
=
bigDecimal
.
setScale
(
places
,
RoundingMode
.
HALF_UP
);
return
bigDecimal
.
doubleValue
();
}
private
void
addMockStates
(
double
radius
,
double
distAtAxis
,
VPoint
vertDistAt45deg
)
{
clearStates
();
addSimState
(
new
SimulationStateMock
(
1
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment