From ccc3ed5bbc9a08ec0a9a5beb7efcd73d81ded296 Mon Sep 17 00:00:00 2001 From: Abe Pazos Date: Sat, 19 Feb 2022 18:23:27 +0100 Subject: [PATCH] [orx-shape] Add last point for open contours (#228) --- orx-shapes/src/commonMain/kotlin/HobbyCurve.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/orx-shapes/src/commonMain/kotlin/HobbyCurve.kt b/orx-shapes/src/commonMain/kotlin/HobbyCurve.kt index ac4b7f5a..5b3cc899 100644 --- a/orx-shapes/src/commonMain/kotlin/HobbyCurve.kt +++ b/orx-shapes/src/commonMain/kotlin/HobbyCurve.kt @@ -11,8 +11,11 @@ import kotlin.math.sin import kotlin.math.sqrt -fun ShapeContour.hobbyCurve() : ShapeContour { - val vertices = segments.map { it.start } +fun ShapeContour.hobbyCurve(): ShapeContour { + val vertices = if (closed) + segments.map { it.start } + else + segments.map { it.start } + segments.last().end return hobbyCurve(vertices, closed) }