Skip to main content

interpolated_offset

Function interpolated_offset 

Source
pub fn interpolated_offset(
    offset: FloatType,
    start: (FloatType, FloatType),
    end: (FloatType, FloatType),
) -> Result<FloatType>
Expand description

Where a thing standing at offset in the source lands in the destination, the same proportion of the way between the two points: the arithmetic of interpolate_elements, for a caller that moves things of its own.

start and end are each a point’s offset in the source and in the destination. It is an error for the two to stand at one offset in the source, since then nothing lies between them to scale.

use music21_rs::tempo::interpolated_offset;

assert_eq!(interpolated_offset(11.0, (10.0, 20.5), (14.0, 25.0))?, 21.625);