Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
aed6fe63
Commit
aed6fe63
authored
Jun 23, 2021
by
Julian Zobel
🦄
Browse files
Square AP generator with radius, radius in AP constructor
parent
c31d45dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/AttractionPoint.java
View file @
aed6fe63
...
...
@@ -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
);
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/EquidistantSquareAttractionGenerator.java
View file @
aed6fe63
...
...
@@ -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
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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