Utilities and base classes for 1D curves. More...
Detailed Description
Utilities and base classes for 1D curves.
This plug-in contains the tools used in score to create and edit curves.
- The triplet Curve::CurveModel, Curve::CurvePresenter, Curve::CurveView represents an editable curve.
- For processes that only use a single curve, base classes are provided for convenience : Curve::CurveProcessModel and Curve::CurveProcessPresenter.
Common curve segments types are provided.
- Todo:
- Put the easing segments defined in the engine library in this library.
A way to skin curves differently according to the curve type is given through Curve::Style.
Typedefs | |
| using | SegmentParameterMap = ossia::flat_map< Id< SegmentModel >, std::pair< double, double > > |
| using | ClickOnNothing_Event = CurveEvent< Element::Nothing_tag, score::Modifier::Click_tag > |
| using | ClickOnPoint_Event = CurveEvent< Element::Point_tag, score::Modifier::Click_tag > |
| using | ClickOnSegment_Event = CurveEvent< Element::Segment_tag, score::Modifier::Click_tag > |
| using | MoveOnNothing_Event = CurveEvent< Element::Nothing_tag, score::Modifier::Move_tag > |
| using | MoveOnPoint_Event = CurveEvent< Element::Point_tag, score::Modifier::Move_tag > |
| using | MoveOnSegment_Event = CurveEvent< Element::Segment_tag, score::Modifier::Move_tag > |
| using | ReleaseOnNothing_Event = CurveEvent< Element::Nothing_tag, score::Modifier::Release_tag > |
| using | ReleaseOnPoint_Event = CurveEvent< Element::Point_tag, score::Modifier::Release_tag > |
| using | ReleaseOnSegment_Event = CurveEvent< Element::Segment_tag, score::Modifier::Release_tag > |
| template<typename T > | |
| using | GenericTransition = score::StateAwareTransition< StateBase, T > |
| using | ClickOnNothing_Transition = PositionedCurveTransition< Element::Nothing_tag, score::Modifier::Click_tag > |
| using | ClickOnPoint_Transition = PositionedCurveTransition< Element::Point_tag, score::Modifier::Click_tag > |
| using | ClickOnSegment_Transition = PositionedCurveTransition< Element::Segment_tag, score::Modifier::Click_tag > |
| using | MoveOnNothing_Transition = PositionedCurveTransition< Element::Nothing_tag, score::Modifier::Move_tag > |
| using | MoveOnPoint_Transition = PositionedCurveTransition< Element::Point_tag, score::Modifier::Move_tag > |
| using | MoveOnSegment_Transition = PositionedCurveTransition< Element::Segment_tag, score::Modifier::Move_tag > |
| using | ReleaseOnNothing_Transition = PositionedCurveTransition< Element::Nothing_tag, score::Modifier::Release_tag > |
| using | ReleaseOnPoint_Transition = PositionedCurveTransition< Element::Point_tag, score::Modifier::Release_tag > |
| using | ReleaseOnSegment_Transition = PositionedCurveTransition< Element::Segment_tag, score::Modifier::Release_tag > |
| using | Point = QPointF |
| using | DefaultCurveSegmentModel = PowerSegment |
| using | DefaultCurveSegmentData = PowerSegmentData |
| using | Segment_backIn = EasingSegment< ossia::easing::backIn > |
| using | Segment_backOut = EasingSegment< ossia::easing::backOut > |
| using | Segment_backInOut = EasingSegment< ossia::easing::backInOut > |
| using | Segment_bounceIn = EasingSegment< ossia::easing::bounceIn > |
| using | Segment_bounceOut = EasingSegment< ossia::easing::bounceOut > |
| using | Segment_bounceInOut = EasingSegment< ossia::easing::bounceInOut > |
| using | Segment_quadraticIn = EasingSegment< ossia::easing::quadraticIn > |
| using | Segment_quadraticOut = EasingSegment< ossia::easing::quadraticOut > |
| using | Segment_quadraticInOut = EasingSegment< ossia::easing::quadraticInOut > |
| using | Segment_cubicIn = EasingSegment< ossia::easing::cubicIn > |
| using | Segment_cubicOut = EasingSegment< ossia::easing::cubicOut > |
| using | Segment_cubicInOut = EasingSegment< ossia::easing::cubicInOut > |
| using | Segment_quarticIn = EasingSegment< ossia::easing::quarticIn > |
| using | Segment_quarticOut = EasingSegment< ossia::easing::quarticOut > |
| using | Segment_quarticInOut = EasingSegment< ossia::easing::quarticInOut > |
| using | Segment_quinticIn = EasingSegment< ossia::easing::quinticIn > |
| using | Segment_quinticOut = EasingSegment< ossia::easing::quinticOut > |
| using | Segment_quinticInOut = EasingSegment< ossia::easing::quinticInOut > |
| using | Segment_sineIn = EasingSegment< ossia::easing::sineIn > |
| using | Segment_sineOut = EasingSegment< ossia::easing::sineOut > |
| using | Segment_sineInOut = EasingSegment< ossia::easing::sineInOut > |
| using | Segment_circularIn = EasingSegment< ossia::easing::circularIn > |
| using | Segment_circularOut = EasingSegment< ossia::easing::circularOut > |
| using | Segment_circularInOut = EasingSegment< ossia::easing::circularInOut > |
| using | Segment_exponentialIn = EasingSegment< ossia::easing::exponentialIn > |
| using | Segment_exponentialOut = EasingSegment< ossia::easing::exponentialOut > |
| using | Segment_exponentialInOut = EasingSegment< ossia::easing::exponentialInOut > |
| using | Segment_elasticIn = EasingSegment< ossia::easing::elasticIn > |
| using | Segment_elasticOut = EasingSegment< ossia::easing::elasticOut > |
| using | Segment_elasticInOut = EasingSegment< ossia::easing::elasticInOut > |
| using | Segment_perlinInOut = EasingSegment< ossia::easing::perlinInOut > |
| using | pow_tables_t = std::array< std::array< double, 76 >, 76 > |
Functions | |
| const CommandGroupKey & | CommandFactoryName () |
| bool | isValidCurve (std::span< const SegmentData > curve) noexcept |
| std::vector< SegmentData > | orderedSegments (const Model &curve) |
| PixelColumns | pixelColumns (double left, double right, double devicePixelsPerUnit) |
| template<typename X , typename Y > | |
| void | envelope (std::size_t n, const X &x, const Y &y, const MinMaxPyramid &pyramid, std::size_t pyramid_offset, double x0, double x1, int columns, std::vector< QPointF > &out) |
| template<typename X , typename Y > | |
| void | envelopeColumns (std::size_t n, const X &x, const Y &y, const MinMaxPyramid &pyramid, std::size_t pyramid_offset, double x0, double width, int columns, std::vector< QLineF > &out) |
| void | checkValidity (std::span< const SegmentData > segts) |
| Debug builds: asserts that segts is a valid curve. | |
| void | createPointAt (std::vector< SegmentData > &segments, Curve::Point pt) |
| std::vector< SegmentData > | removeSegments (const Model &model, const ossia::hash_set< int32_t > &removed, bool fill) |
| bool | operator< (const SegmentData &lhs, const SegmentData &rhs) |
| bool | operator<= (const SegmentData &lhs, const SegmentData &rhs) |
| template<typename Container > | |
| Id< SegmentModel > | getSegmentId (const Container &ids) |
| Id< SegmentModel > | getSegmentId (const std::vector< SegmentData > &ids) |
| Id< SegmentModel > | getSegmentId (const std::vector< Id< SegmentModel > > &ids) |
| Curve::SegmentModel * | createCurveSegment (const Curve::SegmentList &csl, const Curve::SegmentData &dat, QObject *parent) |
| void | setSegmentExtent (SegmentData &seg, QPointF start, QPointF end) |
| std::vector< SegmentData > | curveFromSamples (std::span< const float > values, std::size_t editable_max) |
| std::vector< SegmentData > | editableSegments (const SegmentData &pointArray, double tolerance, SegmentIdAllocator &ids) |
| SegmentData | flatCurveSegment (double val, double min, double max) |
Function Documentation
◆ createPointAt()
| void Curve::createPointAt | ( | std::vector< SegmentData > & | segments, |
| Curve::Point | pt | ||
| ) |
Adds a point at pt: splits the segment under it, moves the point already at its x, or links it to the nearest segments around it.
◆ envelope()
| void Curve::envelope | ( | std::size_t | n, |
| const X & | x, | ||
| const Y & | y, | ||
| const MinMaxPyramid & | pyramid, | ||
| std::size_t | pyramid_offset, | ||
| double | x0, | ||
| double | x1, | ||
| int | columns, | ||
| std::vector< QPointF > & | out | ||
| ) |
A polyline through x-ordered points, columns columns across [x0, x1]: each column's points if it has at most two, else its first, lowest, highest and last. O(columns log N). Point i is pyramid_offset + i in the pyramid.
◆ envelopeColumns()
| void Curve::envelopeColumns | ( | std::size_t | n, |
| const X & | x, | ||
| const Y & | y, | ||
| const MinMaxPyramid & | pyramid, | ||
| std::size_t | pyramid_offset, | ||
| double | x0, | ||
| double | width, | ||
| int | columns, | ||
| std::vector< QLineF > & | out | ||
| ) |
As a waveform: one vertical line per column, across its points and the line through them where it crosses the column's edges, so that columns join and a gap wider than a column is drawn as the ramp it is. Column k spans [x0 + k * width, x0 + (k + 1) * width). O(columns log N).
◆ isValidCurve()
|
noexcept |
Finite coordinates, segments that go forward in x, and previous / following links that form chains. Anything else is refused by Model::fromCurveData.
◆ removeSegments()
| std::vector< SegmentData > Curve::removeSegments | ( | const Model & | model, |
| const ossia::hash_set< int32_t > & | removed, | ||
| bool | fill | ||
| ) |
The curve without the given segments. With fill it is closed again: from the start of a removed first segment, to the end of a removed last one, and across each hole.