Optimized timing at the beginning of an open or closed segment
This commit is contained in:
parent
4af606ae89
commit
2cce8eebd9
|
@ -35,7 +35,11 @@ JoiningContinuousTimeline<Shape> retime(const JoiningContinuousTimeline<Shape>&
|
||||||
centiseconds targetPosition = targetRange.getEnd();
|
centiseconds targetPosition = targetRange.getEnd();
|
||||||
while (targetPosition > targetRange.getStart()) {
|
while (targetPosition > targetRange.getStart()) {
|
||||||
// Determine the time range of source shapes competing for the next target shape
|
// Determine the time range of source shapes competing for the next target shape
|
||||||
TimeRange candidateRange(targetPosition - minShapeDuration, targetPosition);
|
const centiseconds remainingTargetDuration = targetPosition - targetRange.getStart();
|
||||||
|
const bool canFitOneOrLess = remainingTargetDuration <= minShapeDuration;
|
||||||
|
const bool canFitTwo = remainingTargetDuration >= 2 * minShapeDuration;
|
||||||
|
const centiseconds duration = canFitOneOrLess || canFitTwo ? minShapeDuration : remainingTargetDuration / 2;
|
||||||
|
TimeRange candidateRange(targetPosition - duration, targetPosition);
|
||||||
if (targetPosition == targetRange.getEnd()) {
|
if (targetPosition == targetRange.getEnd()) {
|
||||||
// This is the first iteration.
|
// This is the first iteration.
|
||||||
// Extend the candidate range to the right in order to consider all source shapes after the target range.
|
// Extend the candidate range to the right in order to consider all source shapes after the target range.
|
||||||
|
|
Loading…
Reference in New Issue