Commit 21ad9c1d authored by hm-schuhba1's avatar hm-schuhba1

Merge branch 'master' into 151_diff_origin

parents 184bdd82 e9873189
Pipeline #76228 failed with stages
in 46 minutes and 3 seconds
......@@ -46,6 +46,7 @@ VadereModelTests/TestOSM/output/*
VadereModelTests/TestOSM_Group/output/*
VadereModelTests/TestSFM/output/*
VadereModelTests/TestGNM/output/*
VadereModelTests/TestBHM/output/*
VadereModelTests/TestOVM/output/*
VadereModelTests/TestOSM/legacy/*
VadereModelTests/TestOSM_Group/legacy/*
......@@ -67,7 +68,7 @@ VadereGui/output/
#mac osx files
.DS_Store
#linux deskopt dotfiles
#linux desktop dotfiles
**/.directory
/VadereModelTests/TestStairs/output
/VadereModelTests/TestStairs/legacy
......@@ -11,7 +11,9 @@ This software runs on OS X, Windows, and Linux.
VADERE has been developed by [Prof. Dr. Gerta Köster's](http://www.cs.hm.edu/die_fakultaet/ansprechpartner/professoren/koester/index.de.html)
research group at the [Munich University of Applied Sciences](https://www.hm.edu/) at the
[department for Computer Science and Mathematics](http://cs.hm.edu/).
However, we welcome contributions from external sources.
However, we welcome contributions from external sources.
The VADERE framework includes a mesh generator for unstructured high quality 2D meshes called **EikMesh** which is described [here](https://gitlab.lrz.de/vadere/vadere/blob/master/VadereMeshing/README.md).
## Pipeline Status
......
......@@ -4,7 +4,7 @@
# Note: script contains some print statements so that progress can be tracked
# a little bit while script is running in continuous integration pipeline.
# Wach out: call this script from root directory of project. E.g.
# Watch out: call this script from root directory of project. E.g.
#
# python Tools/my_script.py
......@@ -46,6 +46,7 @@ def run_scenario_files_with_vadere_console(scenario_files, vadere_console="Vader
failed_scenarios_with_exception = []
for i, scenario_file in enumerate(scenario_files):
try:
print("Running scenario file ({}/{}): {}".format(i + 1, total_scenario_files, scenario_file))
......@@ -96,6 +97,7 @@ def print_summary(passed_and_failed_scenarios):
print("Failed: {}".format(total_failed_scenarios))
if __name__ == "__main__":
long_running_scenarios = [
"basic_4_1_wall_gnm1",
"queueing",
......@@ -103,8 +105,10 @@ if __name__ == "__main__":
"rimea_11",
"TestSFM",
"thin_wall_and_closer_source_nelder_mead_ok",
"thin_wall_and_closer_source_pso_could_fail"
"thin_wall_and_closer_source_pso_could_fail",
"rimea_04_flow_osm1_550_up",
]
excluded_scenarios = ["TESTOVM", "output", "legacy"]
excluded_scenarios.extend(long_running_scenarios)
......
......@@ -297,6 +297,7 @@ TopographyCreator.btnCutTopography.tooltip=Cut Scenario
TopographyCreator.btnInsertPedestrian.tooltip=Pedestrian
TopographyCreator.btnTopographyBound.tooltip=Topography Bound
TopographyCreator.btnTranslation.tooltip=Translate topography
TopographyCreator.btnElementTranslation.tooltip=Translate topography elements
TopographyCreator.btnInsertObstacle.tooltip=Obstacle
TopographyCreator.btnInsertTarget.tooltip=Target
TopographyCreator.btnInsertSource.tooltip=Source
......
......@@ -293,6 +293,7 @@ TopographyCreator.btnInsertObstacle.tooltip=Hindernis
TopographyCreator.btnInsertTarget.tooltip=Ziel
TopographyCreator.btnTopographyBound.tooltip=Topographie Grenze
TopographyCreator.btnTranslation.tooltip=Topographie verschieben
TopographyCreator.btnElementTranslation.tooltip=Elemente der Topography verschieben
TopographyCreator.btnInsertSource.tooltip=Quelle
TopographyCreator.btnInsertStairs.tooltip=Treppen
TopographyCreator.btnErase.tooltip=Radierer
......
......@@ -174,12 +174,12 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
} else {
if (scenarioElement instanceof AgentWrapper) {
this.txtrTextfiletextarea.setText(
StateJsonConverter.serializeObject(((AgentWrapper) scenarioElement).getAgentInitialStore()));
StateJsonConverter.serializeObjectPretty(((AgentWrapper) scenarioElement).getAgentInitialStore()));
} else if (scenarioElement instanceof Pedestrian) {
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObject(scenarioElement));
this.txtrTextfiletextarea.setText(StateJsonConverter.serializeObjectPretty(scenarioElement));
} else {
this.txtrTextfiletextarea.setText(StateJsonConverter
.serializeObject(scenarioElement.getAttributes()));
.serializeObjectPretty(scenarioElement.getAttributes()));
}
}
}
......
......@@ -4,12 +4,15 @@ import java.awt.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.components.view.DefaultRenderer;
import org.vadere.gui.components.view.SimulationRenderer;
import org.vadere.gui.onlinevisualization.model.OnlineVisualizationModel;
import org.vadere.gui.renderer.agent.AgentRender;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.geometry.shapes.VPoint;
public class OnlinevisualizationRenderer extends SimulationRenderer {
......@@ -102,4 +105,18 @@ public class OnlinevisualizationRenderer extends SimulationRenderer {
}
}
}
/*
* This method should replace pedestrianPositions.get(ped.getId()).addFirst(ped.getPosition());
* However the simulation runs in an separated thread. Therefore, foot steps might be cleared
* before they can be drawn! Solution: deep clone of the topography, which is costly and difficult.
*/
private Stream<VPoint> getFootStepsPosition(@NotNull final Agent agent) {
if(agent instanceof Pedestrian) {
return ((Pedestrian) agent).getFootSteps().stream().map(footStep -> footStep.getStart());
}
else {
return Stream.of(agent.getPosition());
}
}
}
......@@ -111,7 +111,6 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
// to have fast access to the key values.
Map<Integer, Step> map = agentsByStep
.keySet().stream()
.sorted(stepComparator)
.collect(Collectors.toMap(s -> s.getStepNumber(), s -> s));
......
package org.vadere.gui.topographycreator.control;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.topographycreator.model.IDrawPanelModel;
import org.vadere.gui.topographycreator.model.TopographyCreatorModel;
import org.vadere.gui.topographycreator.view.ActionTranslateTopographyDialog;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import java.awt.event.ActionEvent;
import java.awt.geom.Rectangle2D;
import javax.swing.*;
import javax.swing.undo.UndoableEditSupport;
/**
* @author Benedikt Zoennchen
*/
public class ActionTranslateElements extends TopographyAction {
private TopographyAction action;
private final UndoableEditSupport undoableEditSupport;
public ActionTranslateElements(final String name,
final ImageIcon icon,
@NotNull final IDrawPanelModel<?> panelModel,
@NotNull final TopographyAction action,
@NotNull final UndoableEditSupport undoSupport) {
super(name, icon, panelModel);
this.action = action;
this.undoableEditSupport = undoSupport;
}
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(e);
TopographyCreatorModel model = (TopographyCreatorModel) getScenarioPanelModel();
ActionTranslateTopographyDialog dialog = new ActionTranslateTopographyDialog(0, 0);
if (dialog.getValue()){
double x = dialog.getX();
double y = dialog.getY();
TopographyCreatorModel topographyCreatorModel = (TopographyCreatorModel) getScenarioPanelModel();
topographyCreatorModel.translateElements(x, y);
undoableEditSupport.postEdit(new EditTranslateElements(topographyCreatorModel, x, y));
}
getScenarioPanelModel().notifyObservers();
}
}
package org.vadere.gui.topographycreator.control;
import org.jetbrains.annotations.NotNull;
import org.vadere.gui.topographycreator.model.TopographyCreatorModel;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
/**
* @author Benedikt Zoennchen
*/
public class EditTranslateElements extends AbstractUndoableEdit {
private static final long serialVersionUID = 5176192525116057658L;
private final TopographyCreatorModel panelModel;
private final double dx;
private final double dy;
public EditTranslateElements(@NotNull final TopographyCreatorModel panelModel,
final double dx,
final double dy) {
this.panelModel = panelModel;
this.dx = dx;
this.dy = dy;
}
@Override
public void undo() throws CannotUndoException {
panelModel.translateElements(-dx, -dy);
}
@Override
public void redo() throws CannotRedoException {
panelModel.translateTopography(dx, dy);
}
@Override
public boolean canUndo() {
return true;
}
@Override
public boolean canRedo() {
return true;
}
@Override
public String getPresentationName() {
return "translate elements";
}
}
......@@ -335,12 +335,16 @@ public class TopographyCreatorModel extends DefaultModel implements IDrawPanelMo
public void translateTopography(final double x, final double y) {
double oldX = getTopographyBound().x;
double oldY = getTopographyBound().y;
topographyBuilder.translateElements(x - oldX, y - oldY);
translateElements(x - oldX, y - oldY);
setTopographyBound(new VRectangle(x, y, getTopographyBound().getWidth(), getTopographyBound().getHeight()));
setChanged();
}
public void translateElements(final double dx, final double dy) {
topographyBuilder.translateElements(dx, dy);
setChanged();
}
@Override
public VShape translate(final Point vector) {
VPoint worldVector = new VPoint(vector.x / getScaleFactor(), -vector.y / getScaleFactor());
......
......@@ -4,6 +4,7 @@ import org.vadere.gui.projectview.view.ProjectView;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.util.Locale;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
......@@ -22,7 +23,7 @@ public class ActionTranslateTopographyDialog {
public ActionTranslateTopographyDialog(final double x, double y){
this.textField = new JTextField(30);
this.textField.setText(String.format("%f, %f", x, y));
this.textField.setText(String.format(Locale.ENGLISH, "%f, %f", x, y));
this.textField.getDocument().addDocumentListener(new DialogListener());
this.valid = false;
this.x = x;
......
......@@ -31,6 +31,7 @@ import org.vadere.gui.topographycreator.control.ActionSelectSelectShape;
import org.vadere.gui.topographycreator.control.ActionSwitchCategory;
import org.vadere.gui.topographycreator.control.ActionSwitchSelectionMode;
import org.vadere.gui.topographycreator.control.ActionTopographyMakroMenu;
import org.vadere.gui.topographycreator.control.ActionTranslateElements;
import org.vadere.gui.topographycreator.control.ActionTranslateTopography;
import org.vadere.gui.topographycreator.control.ActionUndo;
import org.vadere.gui.topographycreator.control.ActionZoomIn;
......@@ -308,10 +309,14 @@ public class TopographyWindow extends JPanel {
new ImageIcon(Resources.class.getResource("/icons/topography_icon.png")),
panelModel, selectShape, undoSupport);
TopographyAction translateTopography =new ActionTranslateTopography("SetTopograpyBound",
TopographyAction translateTopography =new ActionTranslateTopography("TranslateTopography",
new ImageIcon(Resources.class.getResource("/icons/translation_icon.png")),
panelModel, selectShape, undoSupport);
TopographyAction translateElements =new ActionTranslateElements("TranslateElements",
new ImageIcon(Resources.class.getResource("/icons/translation_elements_icon.png")),
panelModel, selectShape, undoSupport);
/* Makros */
ActionTopographyMakroMenu actionTopographyMakroMenu =
new ActionTopographyMakroMenu("TopographyMakros",
......@@ -353,6 +358,7 @@ public class TopographyWindow extends JPanel {
addActionToToolbar(toolbar, maximizeAction, "TopographyCreator.btnMaximizeTopography.tooltip");
addActionToToolbar(toolbar, resizeTopographyBound, "TopographyCreator.btnTopographyBound.tooltip");
addActionToToolbar(toolbar, translateTopography, "TopographyCreator.btnTranslation.tooltip");
addActionToToolbar(toolbar, translateElements, "TopographyCreator.btnElementTranslation.tooltip");
toolbar.addSeparator(new Dimension(5, 50));
addActionToToolbar(toolbar, selectCutAction, "TopographyCreator.btnCutTopography.tooltip");
addActionToToolbar(toolbar, resetScenarioAction, "TopographyCreator.btnNewTopography.tooltip");
......
# EikMesh
TODO
\ No newline at end of file
......@@ -53,6 +53,16 @@
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.tests.TestPedestrianWaitingTimeProcessor",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesTestPedestrianWaitingTimeProcessor",
"attributes" : {
"expectedResult" : "SUCCESS",
"pedestrianWaitingTimeProcessorId" : 2,
"maximalWaitingTime" : 0.0,
"minimalWaitingTime" : 0.0
}
} ],
"isTimestamped" : true
},
......
......@@ -78,7 +78,7 @@
"finishTime" : 400.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
......
......@@ -102,6 +102,11 @@ public class BehaviouralHeuristicsModel implements MainModel {
@Override
public void update(final double simTimeInSec) {
// all those foot steps are done in previous sim time steps
for(PedestrianBHM ped : pedestrianEventsQueue) {
ped.clearFootSteps();
}
// event driven update
if (!pedestrianEventsQueue.isEmpty()) {
while (pedestrianEventsQueue.peek().getTimeOfNextStep() < simTimeInSec) {
......
......@@ -13,6 +13,7 @@ import org.vadere.state.scenario.Obstacle;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.geometry.shapes.Vector2D;
import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -152,9 +153,11 @@ public class PedestrianBHM extends Pedestrian {
updateTargetDirection();
this.nextPosition = navigation.getNavigationPosition();
VPoint position = getPosition();
makeStep();
getFootSteps().add(new FootStep(position, getPosition(), timeOfNextStep, timeOfNextStep + durationNextStep));
this.timeOfNextStep = timeOfNextStep + durationNextStep;
}
......
......@@ -3,6 +3,7 @@ package org.vadere.simulator.models.bmm;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.vadere.annotation.factories.models.ModelClass;
......@@ -15,6 +16,7 @@ import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
......@@ -92,6 +94,8 @@ public class BiomechanicsModel implements MainModel {
public void update(final double simTimeInSec) {
double deltaTime = simTimeInSec - lastSimTimeInSec;
List<VPoint> positions = pedestriansBMM.stream().map(ped -> ped.getPosition()).collect(Collectors.toList());
for (PedestrianBMM agent : pedestriansBMM) {
agent.update(simTimeInSec, deltaTime);
}
......@@ -104,6 +108,12 @@ public class BiomechanicsModel implements MainModel {
agent.reverseCollisions();
}
for(int i = 0; i < pedestriansBMM.size(); i++) {
PedestrianBMM agent = pedestriansBMM.get(i);
agent.clearFootSteps();
agent.getFootSteps().add(new FootStep(positions.get(i), agent.getPosition(), lastSimTimeInSec, simTimeInSec));
}
this.lastSimTimeInSec = simTimeInSec;
}
......
package org.vadere.simulator.models.ode;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import org.apache.commons.math3.exception.MathIllegalNumberException;
import org.apache.commons.math3.ode.FirstOrderIntegrator;
......@@ -13,6 +15,7 @@ import org.vadere.state.scenario.Car;
import org.vadere.state.scenario.DynamicElement;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.state.types.ScenarioElementType;
import org.vadere.util.geometry.shapes.Vector2D;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -72,6 +75,9 @@ public abstract class ODEModel<T extends DynamicElement, TAttributes extends Att
// get pedestrian and car data
Collection<T> dynamicElements = topography.getElements(type);
List<T> orderedDynamicElements = topography.getElements(type).stream().collect(Collectors.toList());
List<VPoint> positions = orderedDynamicElements.stream().map(ped -> ped.getPosition()).collect(Collectors.toList());
double[] y;
// if no peds are present, return
......@@ -117,6 +123,15 @@ public abstract class ODEModel<T extends DynamicElement, TAttributes extends Att
}
updateElementPositions(type, simTimeInSec, topography, equations, y);
for(int i = 0; i < orderedDynamicElements.size(); i++) {
DynamicElement element = orderedDynamicElements.get(i);
if (element.getType() == ScenarioElementType.PEDESTRIAN) {
Pedestrian pedestrian = (Pedestrian)element;
pedestrian.clearFootSteps();
pedestrian.getFootSteps().add(new FootStep(positions.get(i), pedestrian.getPosition(), lastSimTimeInSec, simTimeInSec));
}
}
}
// reset the time
......@@ -128,8 +143,7 @@ public abstract class ODEModel<T extends DynamicElement, TAttributes extends Att
* double vector.
* The {@link AbstractModelEquations} are used to get the correct positions from the vector.
*/
public static <T extends DynamicElement> void updateElementPositions(Class<T> type, double simTimeInSec,
Topography topography, AbstractModelEquations equations, double[] y) {
public static <T extends DynamicElement> void updateElementPositions(Class<T> type, double t, Topography topography, AbstractModelEquations equations, double[] y) {
Collection<T> dynamicElements = topography.getElements(type);
......
......@@ -25,9 +25,8 @@ public class UpdateSchemeEventDriven implements UpdateSchemeOSM {
@Override
public void update(final double timeStepInSec, final double currentTimeInSec) {
for(PedestrianOSM pedestrianOSM : topography.getElements(PedestrianOSM.class)) {
pedestrianOSM.clearStrides();
}
clearStrides(topography);
if(!pedestrianEventsQueue.isEmpty()) {
// event driven update ignores time credits!
......
......@@ -11,6 +11,7 @@ import org.vadere.state.scenario.DynamicElementAddListener;
import org.vadere.state.scenario.DynamicElementRemoveListener;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.FootStep;
import org.vadere.state.types.UpdateType;
import org.vadere.util.geometry.shapes.Vector2D;
import org.vadere.util.geometry.shapes.VPoint;
......@@ -28,6 +29,16 @@ public interface UpdateSchemeOSM extends DynamicElementRemoveListener<Pedestrian
void update(double timeStepInSec, double currentTimeInSec);
default void clearStrides(@NotNull final Topography topography) {
/**
* strides and foot steps have no influence on the simulation itself, i.e. they are saved to analyse trajectories
*/
for(PedestrianOSM pedestrianOSM : topography.getElements(PedestrianOSM.class)) {
pedestrianOSM.clearStrides();
pedestrianOSM.clearFootSteps();
}
}
static UpdateSchemeOSM create(@NotNull final UpdateType updateType, @NotNull final Topography topography, final Random random) {
switch (updateType) {
case SEQUENTIAL: return new UpdateSchemeSequential(topography);
......@@ -73,6 +84,13 @@ public interface UpdateSchemeOSM extends DynamicElementRemoveListener<Pedestrian
default void makeStep(@NotNull final Topography topography, @NotNull final PedestrianOSM pedestrian, final double stepTime) {
VPoint currentPosition = pedestrian.getPosition();
VPoint nextPosition = pedestrian.getNextPosition();
// start time
double timeOfNextStep = pedestrian.getTimeOfNextStep();
// end time
double entTimeOfStep = pedestrian.getTimeOfNextStep() + pedestrian.getDurationNextStep();
if (nextPosition.equals(currentPosition)) {
pedestrian.setTimeCredit(0);
pedestrian.setVelocity(new Vector2D(0, 0));
......@@ -85,7 +103,11 @@ public interface UpdateSchemeOSM extends DynamicElementRemoveListener<Pedestrian
pedestrian.setVelocity(pedVelocity);
}
pedestrian.getStrides().add(Pair.of(currentPosition.distance(nextPosition), pedestrian.getTimeOfNextStep()));
/**
* strides and foot steps have no influence on the simulation itself, i.e. they are saved to analyse trajectories
*/
pedestrian.getStrides().add(Pair.of(currentPosition.distance(nextPosition), timeOfNextStep));
pedestrian.getFootSteps().add(new FootStep(currentPosition, nextPosition, timeOfNextStep, entTimeOfStep));
}
}
......@@ -32,6 +32,8 @@ public class UpdateSchemeParallel implements UpdateSchemeOSM {
@Override
public void update(double timeStepInSec, double currentTimeInSec) {
clearStrides(topography);
movedPedestrians.clear();
CallMethod[] callMethods = {CallMethod.SEEK, CallMethod.MOVE, CallMethod.CONFLICTS, CallMethod.STEPS};
List<Future<?>> futures;
......
......@@ -18,6 +18,7 @@ public class UpdateSchemeSequential implements UpdateSchemeOSM {
@Override
public void update(double timeStepInSec, double currentTimeInSec) {
clearStrides(topography);
update(topography.getElements(Pedestrian.class), timeStepInSec);
}
......
......@@ -82,9 +82,9 @@ public class PotentialFieldPedestrianCompactSoftshell implements PotentialFieldA
}
/*
@Override
public double getAgentPotential(VPoint pos, Agent pedestrian,
/*@Override
public double getAgentPotential(IPoint pos, Agent pedestrian,
Agent otherPedestrian) {
double radii = pedestrian.getRadius() + otherPedestrian.getRadius(); // 2* r_p (sivers-2016b)
double potential = 0;
......@@ -98,18 +98,18 @@ public class PotentialFieldPedestrianCompactSoftshell implements PotentialFieldA
int perPower = this.attributes.getPersonalSpacePower(); // not defined in sivers-2016b (perPower = 1)
double factor = this.attributes.getIntimateSpaceFactor(); // a_p
if (distance < personalWidth + otherPedestrian.getRadius()) {
if (distance < personalWidth + pedestrian.getRadius()) {
// implementation differs from sivers-2016b here: \delta_{per} + r_p (note: radii = 2*r_p)
potential += this.height * Math.exp(4 / (Math.pow(distance / (personalWidth + radii), (2 * perPower)) - 1));
potential += this.height * Math.exp(4 / (Math.pow(distance / (personalWidth + pedestrian.getRadius()), (2 * perPower)) - 1));
}
if (distance < this.intimateWidth + otherPedestrian.getRadius()) {
if (distance < this.intimateWidth + pedestrian.getRadius()) {
// implementation differs from sivers-2016b here: \delta_{int} + r_p (note: radii = 2*r_p)
potential += this.height / factor
* Math.exp(4 / (Math.pow(distance / (this.intimateWidth + pedestrian.getRadius()), (2 * intPower)) - 1));
}
if (distance < radii) {
// implementations differs from sivers-2016b here : Math.power(distance / (radii),2)
potential += 1000 * Math.exp(1 / (Math.pow(distance / pedestrian.getRadius(), 2) - 1));
potential += 1000 * Math.exp(1 / (Math.pow(distance / radii, 2) - 1));
}
}
return potential;
......
package org.vadere.simulator.models.potential.solver.calculators.mesh;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.vadere.meshing.utils.debug.DebugGui;
import org.vadere.meshing.utils.debug.SimpleTriCanvas;
import org.vadere.util.geometry.GeometryUtils;
import org.vadere.meshing.mesh.inter.IFace;
import org.vadere.meshing.mesh.inter.IHalfEdge;
......@@ -13,7 +12,6 @@ import org.vadere.meshing.mesh.inter.IMesh;
import org.vadere.meshing.mesh.inter.IIncrementalTriangulation;
import org.vadere.meshing.mesh.inter.IVertex;
import org.vadere.util.geometry.shapes.IPoint;
import org.vadere.util.geometry.shapes.VLine;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VShape;
import org.vadere.util.math.InterpolationUtil;
......@@ -24,13 +22,16 @@ import org.vadere.util.data.cellgrid.IPotentialPoint;
import org.vadere.simulator.models.potential.solver.timecost.ITimeCostFunction;
import org.vadere.util.math.IDistanceFunction;
import java.awt.*;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
......@@ -48,6 +49,10 @@ import java.util.function.Predicate;
public class EikonalSolverFMMTriangulation<P extends IPotentialPoint, V extends IVertex<P>, E extends IHalfEdge<P>, F extends IFace<P>> implements EikonalSolver {
private static Logger logger = LogManager.getLogger(EikonalSolverFMMTriangulation.class);
private Set<F> nonAccuteTris = new HashSet<>();
private Map<Triple<P, P, P>, Double> angles = new HashMap();
private Map<Triple<P, P, P>, Double> sinPhis = new HashMap();
private Map<Triple<P, P, P>, Double> cosPhis = new HashMap();
static {
logger.setLevel(Level.INFO);
......@@ -58,6 +63,10 @@ public class EikonalSolverFMMTriangulation<P extends IPotentialPoint, V extends
*/
private ITimeCostFunction timeCostFunction;
private IDistanceFunction distFunc;
private Collection<V> targetVertices;
/**
* The triangulation the solver uses.
*/
......@@ -154,30 +163,12 @@ public class EikonalSolverFMMTriangulation<P extends IPotentialPoint, V extends
this.calculationFinished = false;
this.timeCostFunction = timeCostFunction;
this.narrowBand = new PriorityQueue<>(pointComparator);
for(V vertex : targetVertices) {
P potentialPoint = getMesh().getPoint(vertex);
double distance = -distFunc.apply(potentialPoint);
if(potentialPoint.getPathFindingTag() != PathFindingTag.Undefined) {
narrowBand.remove(vertex);
}
potentialPoint.setPotential(Math.min(potentialPoint.getPotential(), distance / timeCostFunction.costAt(potentialPoint)));
potentialPoint.setPathFindingTag(PathFindingTag.Reached);
narrowBand.add(vertex);
for(V v :