Add more comments

pull/55/head
trivernis 5 years ago
parent c090977021
commit 03eaf52dc3

@ -28,12 +28,19 @@ class Circle(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
return r return r
} }
/**
* Returns the edge locations of the shape to be used
* with dynmap markers
*/
override fun getShapeEdgeLocations(): List<Pair<Int, Int>> { override fun getShapeEdgeLocations(): List<Pair<Int, Int>> {
val locations = this.getCircleCoordinates(this.radius) val locations = this.getCircleCoordinates(this.radius)
locations.add(locations.first()) locations.add(locations.first())
return locations.map{ Pair(it.first + center.first, it.second + center.second) } return locations.map{ Pair(it.first + center.first, it.second + center.second) }
} }
/**
* Returns the next coordinate of the circle until the end is reached
*/
override fun next(): Pair<Int, Int> { override fun next(): Pair<Int, Int> {
if (endReached()) { if (endReached()) {
return currentPos return currentPos

@ -69,6 +69,9 @@ class Spiral(center: Pair<Int, Int>, start: Pair<Int, Int>, radius: Int): Shape(
return currentPos return currentPos
} }
/**
* Returns the edges to be used with dynmap markers
*/
override fun getShapeEdgeLocations(): List<Pair<Int, Int>> { override fun getShapeEdgeLocations(): List<Pair<Int, Int>> {
val a = Pair(this.radius + center.first, this.radius + center.second) val a = Pair(this.radius + center.first, this.radius + center.second)
val b = Pair(this.radius + center.first, -this.radius + center.second) val b = Pair(this.radius + center.first, -this.radius + center.second)

Loading…
Cancel
Save