All notable changes to the cavalier_contours crate will be documented in this file.
- Improved
parallel_offsetrobustness for repeat-position/degenerate input by sanitizing repeat vertices in release builds and guarding offset vector normalization against near-zero vectors.
⚠️ BREAKING: Added collapsed area parameter to pline boolean options to allow for pruning collapsed polylines from results. This is only breaking due to struct initialization, if you use default initialization this defaults to no change in behavior (#71).- Added
examplescrate to workspace to demonstrate cavalier_contours functionality (#74).
- Fixed bug in pline segment intersection when two arcs only touch at endpoints at one point, have the same arc radius and center, and are in opposite directions. This also fixes some cases for algorithms that depend on finding interescts (boolean, offset, etc.) (#71).
- Fixed offset slice stitching to use consistent epsilon (
join_eps) when removing repeat vertices, preventing tiny segments at slice boundaries when offsetting polylines with close vertices (#77).
- Added
eguiinteractive demo UI crate and auto deployment to GitHub pages for the demo page is here. - Added
visit_intersects,contains, andscan_for_self_intersectto pline traits (#68). - Added
user_datato traits for tracking data through operations (#63). - Added multi polyline offset algorithm to c ffi (#63).
- Added more doc comments/tests for
PlineSourceandPlineSourceMut. - Added
README.mdfile tocavalier_contours_fficrate.
⚠️ BREAKING: Updated MSRV to 1.88 and Rust edition 2024. Only breaking if unable to compile with Rust 1.88 or later.- Refactored multipolyline offset algorithm to be step-by-step.
- Simplified
prune_slicesfunction in pline_boolean. - Refactored two-polyline intersection visitation to use visitor pattern and eliminated allocation inside loop (#68).
⚠️ BREAKING: Fix memory leak in cavc_plinelist by implementing Drop trait (#64). This is not likely breaking for most users but if you are callingcavc_pline_fon each pline in acavc_plinelistwithout removing them from the list then you will get a double free on the plines not removed when thecavc_plinelistis freed/dropped.- Improved offset slice validation by checking multiple segment midpoints (#69). Fixes bug reported in issue #66.
cargo releasegot so excited it jumped a version! Nothing to see here...
- Added
Shapetype and parallel offset method on shape type to perform simultaneous multi/island polyline parallel offsetting (#7).
⚠️ BREAKING: Removedslice_join_epsfromPlineBooleanOptions. This is breaking for any code that interacts with this option struct directly (does not use defaults).slice_join_epswas also removed from the equivalentcavc_pline_boolean_ostruct in the C FFI. (#31)⚠️ BREAKING:PlineSource::create_aabb_indexandPlineSource::create_approx_aabb_indexnow just return aStaticAABB2DIndexrather than anOption<StaticAABB2DIndex>. The equivalent C api callscavc_pline_create_aabbindexandcavc_pline_create_approx_aabbindexalso no longer return an error code of 2 when polyline has less than 2 vertexes (empty aabb index is returned). (#29)- Updated
StaticAABB2DIndexdependency to version 2.0. - Bumped rust edition to 2021.
- Use
with_capacityinstead ofreservein some places to avoid over allocation behavior of Vec (minor performance improvement).
- Fixed
PlineView::from_slice_pointsto handle wrapping on same segment (#28). - Fixed
line_circle_intraccuracy in cases with nearly vertical line (#30).
- Added
BooleanResultInfoenum used for newresult_infofield onBooleanResult. The enum is used to return information about what happened during the boolean operation. - Added doc tests and improved documentation to intersect functions
circle_circle_intr,line_circle_intr, andline_line_intr(#18). - Added
#![forbid(unsafe_code)]to maincavalier_contourscrate to ensure no use of unsafe (obviously does not apply to thecavalier_contours_fficrate).
- Added epsilon parameter to
PlineSource::closest_pointmethod to allow for consistency with other calculations using epsilon values for fuzzy comparing. line_line_intrfunction now scales parametric t values by segment lengths before fuzzy comparing with epsilon value to avoid introduced error when line segments are very long or very short.pline_seg_intrfunction now scales parametric t values by segment lengths and angle values by arc radii before fuzzy comparing with epsilon value to avoid introduced error when line segments are very long or very short, or arc radius is very small or very large.- Reimplemented
line_circle_intrfunction for improved numerical stability. - Added epsilon parameter to
parametric_from_pointfunction to allow consistency with other calculations using epsilon values for fuzzy comparing. - Reduce error in calculation done in
parametric_from_pointby using larger component difference rather than explicitly checking for vertical line case. - Added epsilon parameter to
point_within_arc_sweepfunction to allow for consistency with other calculations using epsilon values for fuzzy comparing. - Added
#[inline]attribute to all of the small Vector2 and base math functions. - Updated
static_aabb2d_indexcrate to 0.7.0 (for use ofIndexableNum::total_cmp). - Replaced all uses for
PartialOrd::partial_cmpwithIndexableNum::total_cmpto avoid panics whenpartial_cmpreturnsNone(e.g., if float is a NaN) and to eliminate branch in compare.
- Fixed
PlineSource::remove_redundantto use epsilon values in all fuzzy compares. Previously used default epsilon value from Num trait in some comparisons. If epsilon value passed in is less than default Num trait value (1e-8forf32andf64values) then it is more aggressive in removing vertexes. - Fixed pline
find_intersectsfunction to use epsilon parameter in all cases. - Fixed boolean operation bugs caused by
line_circle_intrnumerical stability problem, inconsistencies between epsilon values used across functions, and lack of scaling parametric t values and angles for fuzzy comparing with epsilon values (#23). - Fixed some of the doc comments around pline boolean operation types.
- Fixed polyline find_intersects to use pos_equal_eps passed in options for querying bounding boxes (#22).
- Fixed
PlineViewData::from_new_startto not discard bulge value if start point lies on top of the first vertex of a closed polyline, and added tests to cover case. - Fixed pline
remove_redundantpanic when there was more than 2 equal points at start (#26).
- Added CHANGELOG.md file for tracking changes and releases.
- New traits
PlineSource,PlineSourceMut, andPlineCreationfor sharing methods across different polyline data views (for example sub views/selections over polylines or direction inversion). PlineViewDataandPlineViewtypes.PlineViewimplementsPlineSourcetrait allowing for flexible views over polyline data to be processed with all the shared behavior/methods.PlineViewDataholds the data used to index into an underlying source polyline to form aPlineView.
- All Polyline methods have moved to the appropriate trait (
PlineSource,PlineSourceMut, orPlineCreation). - Slices used in offset and boolean operations now all use new
PlineViewDataandPlineViewtypes. - Changed polyline methods that returned
Cowtypes to returnOptiontypes to indicate if changes were done on the input polyline or not. - Changed intersect functions (
circle_circle_intr,line_circle_intr, andline_line_intr) to accept epsilon value parameter for fuzzy float comparisons. - Changed polyline offset and boolean operations to use
pos_equal_epsepsilon value in intersect functions. - Changed
pline_seg_intrfunction to avoid inconsistencies between intersect functions in some cases involving line-arc intersects due to fuzzy comparing - this fixes problems that can arise in operations that depend on finding intersects. - Added
include_overlappingparameter toall_self_intersects_as_basicfunction.
- Fixed arc overlap intersects not being found in some cases and segment intersects disagreeing due to fuzzy comparing causing incorrect output for polyline boolean operations and added test cases that found the issue.
- Fixed bug in parallel offset caused when raw offset polyline produced an overlapping self intersect. Parallel offset algorithm no longer includes overlapping intersects when finding self intersects of raw offset polyline for creating slices.
Polyline::visit_segments(usePlineSource::iter_segmentsinstead).Polyline::lenmethod removed (usePlineSource::vertex_countinstead).PolylineSlicetrait andOpenPlineSlicetype (covered by new view types and polyline traits).PolylineSlice::stitch_ontoandPolylineSlice::to_polylineremoved, to get same functionality construct the view withPlineData::viewand pass it toPlineSourceMut::extend_remove_repeatorPlineCreation::create_from_remove_repeat.