[orx-fcurve] Add FCurve.start, Fcurve.end, MultiFCurve.start, MultiFCurve.end

This commit is contained in:
Edwin Jakobs
2024-05-09 16:10:51 +02:00
parent 8f68c918f2
commit 968d544d3b
3 changed files with 44 additions and 0 deletions

View File

@@ -129,6 +129,31 @@ data class FCurve(val segments: List<Segment2D>) {
* The unitless duration of the Fcurve
*/
val duration: Double
get() {
return if (segments.isEmpty()) {
0.0
} else {
end - start
}
}
/**
* The unitless start position of the Fcurve
*/
val start: Double
get() {
return if (segments.isEmpty()) {
0.0
} else {
segments.first().start.x
}
}
/**
* The unitless end position of the Fcurve
*/
val end: Double
get() {
return if (segments.isEmpty()) {
0.0
@@ -137,6 +162,7 @@ data class FCurve(val segments: List<Segment2D>) {
}
}
/**
* Evaluate the Fcurve at [t]
* @param segment an optional segment that can be used to speed up scanning for the relevant segment