[orx-shapes] Improve support for open contours in adjustContour

This commit is contained in:
Edwin Jakobs
2023-10-30 07:53:40 +01:00
parent 2293d5d74e
commit 6e14b36540
8 changed files with 132 additions and 59 deletions

View File

@@ -85,6 +85,11 @@ data class ContourEdge(
}
}
val length: Double
get() {
return contour.segments[segmentIndex].length
}
/**
* replace this edge with a point at [t]
@@ -124,7 +129,8 @@ data class ContourEdge(
}.windowed(2, 1).map {
r.sub(it[0], it[1])
}
return replacedWith(ShapeContour.fromContours(newSegments, false))
require(newSegments.size == parts)
return replacedWith(ShapeContour.fromContours(newSegments, false, 1.0))
}
fun replacedWith(openContour: ShapeContour): ContourEdge {