1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2023 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Lesser General Public License that can be found
// in the LICENSE file.
use crate::core::point::Point;
use crate::core::scalar::ScalarExt;
/// Fast evaluation of a cubic ease-in / ease-out curve.
///
/// This is defined as a parametric cubic curve inside the unit square.
///
/// pt[0] is implicitly { 0, 0 }
/// pt[3] is implicitly { 1, 1 }
/// pts[1, 2].x are inside the unit [0..1]
pub struct CubicMap {
coeff: [Point; 3],
type_: Type,
}
#[repr(u8)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Type {
/// x == y
Line,
/// At^3 == x
CubeRoot,
/// general monotonic cubic solver
Solver,
}
impl CubicMap {
#[must_use]
pub fn new(_p1: Point, _p2: Point) -> Self {
unimplemented!()
}
#[must_use]
pub fn is_linear(p1: Point, p2: Point) -> bool {
p1.x().nearly_equal(p1.y()) && p2.x().nearly_equal(p2.y())
}
#[must_use]
pub fn compute_y_from_x(&self, _x: f32) -> f32 {
unimplemented!()
}
#[must_use]
pub fn compute_from_t(&self, _t: f32) -> Point {
unimplemented!()
}
}