Commit b525cd91 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Merge branch 'master' into tukl_cooperation

parents dec5690e ae1a4492
......@@ -42,10 +42,9 @@ public class ActionSetTimeStep extends ActionVisualization implements ChangeList
@Override
public void stateChanged(final ChangeEvent event) {
JSlider source = (JSlider) event.getSource();
if(!source.getValueIsAdjusting()) {
model.setStep(source.getValue());
model.notifyObservers();
}
JSlider slider = (JSlider) event.getSource();
model.setStep(slider.getValue());
model.notifyObservers();
}
}
......@@ -20,23 +20,17 @@ public class EJSliderAction implements MouseListener {
@Override
public void mousePressed(final MouseEvent e) {
setSliderValue(e);
}
@Override
public void mouseReleased(final MouseEvent e) {
Point p = e.getPoint();
double percent = p.x / ((double) slider.getWidth());
int range = slider.getMaximum() - slider.getMinimum();
double newVal = range * percent;
int result = (int) (Math.ceil(slider.getMinimum() + newVal));
// logger.info("change to step: " + Thread.currentThread().getName() + (result+1));
slider.setValue(result);
setSliderValue(e);
}
@Override
public void mouseClicked(MouseEvent e) {
setSliderValue(e);
}
@Override
......@@ -48,4 +42,14 @@ public class EJSliderAction implements MouseListener {
public void mouseExited(MouseEvent e) {
}
private void setSliderValue(MouseEvent e) {
Point sliderPosition = e.getPoint();
double percent = sliderPosition.x / ((double) slider.getWidth());
int sliderRange = slider.getMaximum() - slider.getMinimum();
double newValue = sliderRange * percent;
int result = (int) (Math.ceil(slider.getMinimum() + newValue));
slider.setValue(result);
}
}
......@@ -61,7 +61,7 @@ public class EikMeshPlots {
//roomLFS();
//cornerLFS();
uniformRing(0.3);
//uniformRing(0.3);
}
public static void randomDelaunay() throws IOException {
......
......@@ -35,8 +35,8 @@ public class EikMeshPoly {
//meshPoly("/poly/bridge.poly");
//meshPoly("/poly/room.poly");
//meshPoly("/poly/corner.poly");
//meshPoly("/poly/railing.poly");
displayPolyFile("/poly/muenchner_freiheit.poly");
meshPoly("/poly/railing.poly");
//displayPolyFile("/poly/muenchner_freiheit.poly");
}
public static void meshPoly(@NotNull final String fileName) throws IOException, InterruptedException {
......
......@@ -698,7 +698,7 @@ public class GenEikMesh<V extends IVertex, E extends IHalfEdge, F extends IFace>
}
private boolean isSlidePoint(@NotNull V vertex) {
return getMesh().isAtBoundary(vertex) && !isFixPoint(vertex);
return getMesh().isAtBoundary(vertex) && !isFixPoint(vertex) && boundaryPointToLine.containsKey(vertex);
}
/**
......
......@@ -10,6 +10,7 @@ import org.vadere.meshing.mesh.gen.PMesh;
import org.vadere.meshing.mesh.gen.PVertex;
import org.vadere.meshing.mesh.inter.IIncrementalTriangulation;
import org.vadere.meshing.utils.io.poly.MeshPolyReader;
import org.vadere.meshing.utils.io.poly.MeshPolyWriter;
import org.vadere.simulator.models.potential.solver.calculators.EikonalSolver;
import org.vadere.simulator.models.potential.solver.calculators.mesh.EikonalSolverFMMTriangulation;
import org.vadere.simulator.models.potential.solver.timecost.UnitTimeCostFunction;
......@@ -27,8 +28,8 @@ public class TestFMMEikMesh {
@Test
public void testTriangulationFMM() throws IOException {
final InputStream inputStream = MeshExamples.class.getResourceAsStream("/poly/muenchner_freiheit.poly");
MeshPolyReader<PVertex, PHalfEdge, PFace> meshPolyWriter = new MeshPolyReader<>(() -> new PMesh());
var mesh = meshPolyWriter.readMesh(inputStream);
MeshPolyReader<PVertex, PHalfEdge, PFace> meshReader = new MeshPolyReader<>(() -> new PMesh());
var mesh = meshReader.readMesh(inputStream);
IIncrementalTriangulation<PVertex, PHalfEdge, PFace> triangulation = new IncrementalTriangulation<>(mesh);
......@@ -50,6 +51,10 @@ public class TestFMMEikMesh {
log.info("FFM finished");
log.info("time: " + (System.currentTimeMillis() - ms));
System.out.println(mesh.toPythonTriangulation(v -> triangulation.getMesh().getDoubleData(v, "potential")));
MeshPolyWriter<PVertex, PHalfEdge, PFace> meshPolyWriter = new MeshPolyWriter<>();
System.out.println(meshPolyWriter.to2DPoly(triangulation.getMesh(), 1, i -> "potential", v -> false));
//System.out.println(mesh.toPythonTriangulation(v -> triangulation.getMesh().getDoubleData(v, "potential")));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment