Class ClosestConnectionPointSelector
Point selector that selects the two points from the MapArea instances that are closest to each other, according to the given distance calculation.
Inheritance
Implements
Inherited Members
Namespace: GoRogue.MapGeneration.Connectors
Assembly: GoRogue.dll
Syntax
public class ClosestConnectionPointSelector : IAreaConnectionPointSelector
Constructors
| Improve this Doc View SourceClosestConnectionPointSelector(Distance)
Constructor.
Declaration
public ClosestConnectionPointSelector(Distance distanceCalculation)
Parameters
Type | Name | Description |
---|---|---|
Distance | distanceCalculation | Distance calculation to use to determine closeness. |
Properties
| Improve this Doc View SourceDistanceCalculation
Distance calculation to use to determine closeness.
Declaration
public Distance DistanceCalculation { get; }
Property Value
Type | Description |
---|---|
Distance |
Methods
| Improve this Doc View SourceSelectConnectionPoints(IReadOnlyMapArea, IReadOnlyMapArea)
Determines the two points in the given map areas that are closest to each other, and returns
them as a tuple of two positions. The first position is the position in area1
to use,
and the second is the position in area2
to use.
Declaration
public Tuple<Coord, Coord> SelectConnectionPoints(IReadOnlyMapArea area1, IReadOnlyMapArea area2)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyMapArea | area1 | First MapArea to connect. |
IReadOnlyMapArea | area2 | Second MapArea to connect. |
Returns
Type | Description |
---|---|
System.Tuple<Coord, Coord> | A tuple containing the coordinates from each MapArea to connect -- the first item in the
tuple is the position in |
Remarks
This algorithm can be relatively time-complex -- O(m*n) where m is the number of coordinates in area1, and n is the number of coordintes in area2.