Skip to content

Commit

Permalink
Merge pull request #30 from mattatz/develop
Browse files Browse the repository at this point in the history
0.1.34
  • Loading branch information
mattatz authored Oct 22, 2024
2 parents 9f7a17e + 5d17943 commit 65dc320
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "curvo"
version = "0.1.33"
version = "0.1.34"
authors = ["Masatatsu Nakamura <masatatsu.nakamura@gmail.com"]
edition = "2021"
keywords = ["nurbs", "modeling", "graphics", "3d"]
Expand Down
15 changes: 11 additions & 4 deletions src/curve/nurbs_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,15 @@ where
};
let segments = &segments[i..j];

if segments.is_empty() {
return Ok(T::zero());
}

let (_, u) = self.knots_domain();
let gauss = GaussLegendre::new(16 + self.degree)?;

if segments.len() <= 1 {
// If the curve is a single Bezier segment, compute the length directly
let l = compute_bezier_segment_length(self, u, &gauss);
return Ok(l);
}

let length = segments
.iter()
.map(|s| compute_bezier_segment_length(s, u, &gauss))
Expand Down Expand Up @@ -1550,6 +1553,10 @@ where
});
}

if segments.len() <= 1 {
return Ok(vec![cloned]);
}

Ok(segments)
}

Expand Down

0 comments on commit 65dc320

Please sign in to comment.