[orx-fcurve] Add FCurve.start, Fcurve.end, MultiFCurve.start, MultiFCurve.end
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user