Polygon

open class Polygon<P : Position2D<out P>>(environment: Environment<*, P>, randomGenerator: RandomGenerator, nodes: Int, pointsInput: List<*>) : AbstractRandomDeployment<P>

Creates a new Polygon with the given points.

Parameters

environment

the simulation environment

randomGenerator

the RNG used for placements

nodes

the count of nodes that need to get displaced inside the polygon

pointsInput

the points of the polygon. The class does not check for "malformed" polygons (e.g. with intersections). If the provided points do not represent a valid polygon in bidimensional space, the behaviour of this class is undefined. There polygon is closed automatically (there is no need to pass the first point also as last element).

Type Parameters

P

the position2D type

Constructors

Link copied to clipboard
constructor(environment: Environment<*, P>, randomGenerator: RandomGenerator, nodes: Int, pointsInput: List<*>)

Functions

Link copied to clipboard

Returns the optional NetworkModel associated to the deployment, or null if there is none.

Link copied to clipboard
open operator override fun iterator(): Iterator<P>
Link copied to clipboard
fun <R> Iterable<R>.randomElement(randomGenerator: RandomGenerator): R

Returns a random element of the Iterable using the provided randomGenerator.

Link copied to clipboard
fun <R> Iterable<R>.shuffled(randomGenerator: RandomGenerator): Iterable<R>

Fisher–Yates shuffle algorithm using a RandomGenerator. More information on Wikipedia.

Link copied to clipboard
open override fun stream(): Stream<P>

Returns a Stream over the positions of this Deployment.