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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use crateInterpolatable;
use PointWise;
;
// impl Partial for ComponentData<Width> {
// fn get_partial(&self, range: std::ops::Range<f32>) -> Self {
// let start = range.start * (self.len() - 1) as f32;
// let end = range.end * (self.len() - 1) as f32;
// let full_start_anchor_idx = (start.floor() + 1.0) as usize;
// let full_end_anchor_idx = (end.ceil() - 1.0) as usize;
// if end - start < 1.0 {
// let vstart = self.0[full_start_anchor_idx - 1]
// .lerp(&self.0[full_start_anchor_idx], start.fract());
// let vend = self.0[full_start_anchor_idx - 1]
// .lerp(&self.0[full_start_anchor_idx], end.fract());
// return vec![vstart, vend].into();
// }
// let mut partial = Vec::with_capacity(full_end_anchor_idx - full_start_anchor_idx + 1 + 2);
// let start_fract = 1.0 - (full_start_anchor_idx as f32 - start);
// let start_v =
// self.0[full_start_anchor_idx - 1].lerp(&self.0[full_start_anchor_idx], start_fract);
// partial.push(start_v);
// if let Some(part) = self.0.get(full_start_anchor_idx..=full_end_anchor_idx) {
// partial.extend_from_slice(part);
// }
// let end_fract = end - full_end_anchor_idx as f32;
// let end_v = self.0[full_end_anchor_idx].lerp(&self.0[full_end_anchor_idx + 1], end_fract);
// partial.push(end_v);
// partial.into()
// }
// }
// impl Deref for Width {
// type Target = f32;
// fn deref(&self) -> &Self::Target {
// &self.0
// }
// }
// impl DerefMut for Width {
// fn deref_mut(&mut self) -> &mut Self::Target {
// &mut self.0
// }
// }