Fix several bugged vector-related nodes

This commit is contained in:
Keavon Chambers
2024-12-26 16:36:45 -08:00
parent feba87449b
commit b81f48385a
4 changed files with 5 additions and 7 deletions
+1 -3
View File
@@ -360,11 +360,9 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
/// The intersections of segments of the subpath are joined using the method specified by the `join` argument.
/// <iframe frameBorder="0" width="100%" height="400px" src="https://graphite.rs/libraries/bezier-rs#subpath/offset/solo" title="Offset Demo"></iframe>
pub fn offset(&self, distance: f64, join: Join) -> Subpath<PointId> {
assert!(self.len_segments() > 1, "Cannot offset an empty Subpath.");
// An offset at a distance 0 from the curve is simply the same curve
// An offset of a single point is not defined
if distance == 0. || self.len() == 1 {
if distance == 0. || self.len() <= 1 || self.len_segments() < 1 {
return self.clone();
}