Tweaks, crash fixes and a few new nodes

This commit is contained in:
Oliver Davies 2025-04-28 18:46:22 -07:00
parent 0c3cae2ba5
commit 914360551f
5 changed files with 602 additions and 24 deletions

View file

@ -77,8 +77,8 @@ impl Bezier {
pub(crate) fn t_value_to_parametric(&self, t: TValue) -> f64 {
match t {
TValue::Parametric(t) => {
assert!((0.0..=1.).contains(&t));
t
// Clamp the t value to the valid range [0.0, 1.0]
t.clamp(0.0, 1.0)
}
TValue::Euclidean(t) => {
assert!((0.0..=1.).contains(&t));

View file

@ -212,7 +212,8 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
(segment_index, t)
}
SubpathTValue::GlobalParametric(global_t) => {
assert!((0.0..=1.).contains(&global_t));
// Clamp global_t to the valid range [0, 1] instead of asserting
let global_t = global_t.clamp(0.0, 1.0);
if global_t == 1. {
return (self.len_segments() - 1, 1.);