From 03eaf52dc3a5d49d247818cb435ef4559a9449f0 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 19 Apr 2020 10:43:12 +0200 Subject: [PATCH] Add more comments --- .../kotlin/net/trivernis/chunkmaster/lib/shapes/Circle.kt | 7 +++++++ .../kotlin/net/trivernis/chunkmaster/lib/shapes/Spiral.kt | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Circle.kt b/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Circle.kt index 19aa335..be03db5 100644 --- a/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Circle.kt +++ b/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Circle.kt @@ -28,12 +28,19 @@ class Circle(center: Pair, start: Pair, radius: Int): Shape( return r } + /** + * Returns the edge locations of the shape to be used + * with dynmap markers + */ override fun getShapeEdgeLocations(): List> { val locations = this.getCircleCoordinates(this.radius) locations.add(locations.first()) 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 { if (endReached()) { return currentPos diff --git a/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Spiral.kt b/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Spiral.kt index 47afefb..75ee564 100644 --- a/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Spiral.kt +++ b/src/main/kotlin/net/trivernis/chunkmaster/lib/shapes/Spiral.kt @@ -69,6 +69,9 @@ class Spiral(center: Pair, start: Pair, radius: Int): Shape( return currentPos } + /** + * Returns the edges to be used with dynmap markers + */ override fun getShapeEdgeLocations(): List> { val a = Pair(this.radius + center.first, this.radius + center.second) val b = Pair(this.radius + center.first, -this.radius + center.second)