Commit aed6fe63 authored by Julian Zobel's avatar Julian Zobel 🦄
Browse files

Square AP generator with radius, radius in AP constructor

parent c31d45dd
......@@ -63,6 +63,11 @@ public class AttractionPoint extends BasicAttractionPoint {
Monitor.getOrNull(IAttractionBasedMovementAnalyzer.class).onAttractionPointAdded(this);
}
}
public AttractionPoint(String name, PositionVector posVec, double radius) {
this(name, posVec);
this.radius = radius;
}
public AttractionPoint(String name, PositionVector posVec, double weight, double radius, long pauseTimeMin, long pauseTimeMax) {
this(name, posVec);
......
......@@ -21,24 +21,24 @@
package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import java.util.LinkedList;
import java.util.List;
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
/**
* Attraction Generator, providing 4 equidistant attraction points, i.e., in a square
* Attraction Generator, providing 4 equidistant attraction points, i.e., in a square.
*
* @author Julian Zobel
* @version 1.0, Nov 2018
*/
public class EquidistantSquareAttractionGenerator extends AbstractAttractionProvider {
private PositionVector worldDimension;
private double squareSize;
private double radius;
@XMLConfigurableConstructor({ "squareSize" })
public EquidistantSquareAttractionGenerator(double squareSize) {
@XMLConfigurableConstructor({ "squareSize", "radius" })
public EquidistantSquareAttractionGenerator(double squareSize, double radius) {
this.squareSize = squareSize;
this.radius = radius;
createAttractionPoints();
}
......@@ -56,16 +56,16 @@ public class EquidistantSquareAttractionGenerator extends AbstractAttractionProv
double y = worldDimension.getY() / 2;
PositionVector p1 = new PositionVector(x - squareSize, y - squareSize);
this.addAttractionPoint(new AttractionPoint("AP1", p1));
this.addAttractionPoint(new AttractionPoint("AP1", p1, radius));
PositionVector p2 = new PositionVector(x - squareSize, y + squareSize);
this.addAttractionPoint(new AttractionPoint("AP2", p2));
this.addAttractionPoint(new AttractionPoint("AP2", p2, radius));
PositionVector p3 = new PositionVector(x + squareSize, y - squareSize);
this.addAttractionPoint(new AttractionPoint("AP3", p3));
this.addAttractionPoint(new AttractionPoint("AP3", p3, radius));
PositionVector p4 = new PositionVector(x + squareSize, y + squareSize);
this.addAttractionPoint(new AttractionPoint("AP4", p4));
this.addAttractionPoint(new AttractionPoint("AP4", p4, radius));
}
......
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