All notable changes to the cavalier_contours crate will be documented in this file.
- Added
Shape
type and parallel offset method on shape type to perform simultaneous multi/island polyline parallel offsetting (#7).
⚠️ BREAKING: Removedslice_join_eps
fromPlineBooleanOptions
. This is breaking for any code that interacts with this option struct directly (does not use defaults).slice_join_eps
was also removed from the equivalentcavc_pline_boolean_o
struct in the C FFI. (#31)⚠️ BREAKING:PlineSource::create_aabb_index
andPlineSource::create_approx_aabb_index
now just return aStaticAABB2DIndex
rather than anOption<StaticAABB2DIndex>
. The equivalent C api callscavc_pline_create_aabbindex
andcavc_pline_create_approx_aabbindex
also no longer return an error code of 2 when polyline has less than 2 vertexes (empty aabb index is returned). (#29)- Updated
StaticAABB2DIndex
dependency to version 1.0. - Bumped rust edition to 2021.
- Use
with_capacity
instead ofreserve
in some places to avoid over allocation behavior of Vec (minor performance improvement).
- Fixed
PlineView::from_slice_points
to handle wrapping on same segment (#28). - Fixed
line_circle_intr
accuracy in cases with nearly vertical line (#30).
- Added
BooleanResultInfo
enum used for newresult_info
field 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_contours
crate to ensure no use of unsafe (obviously does not apply to thecavalier_contours_ffi
crate).
- Added epsilon parameter to
PlineSource::closest_point
method to allow for consistency with other calculations using epsilon values for fuzzy comparing. line_line_intr
function 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_intr
function 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_intr
function for improved numerical stability. - Added epsilon parameter to
parametric_from_point
function to allow consistency with other calculations using epsilon values for fuzzy comparing. - Reduce error in calculation done in
parametric_from_point
by using larger component difference rather than explicitly checking for vertical line case. - Added epsilon parameter to
point_within_arc_sweep
function 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_index
crate to 0.7.0 (for use ofIndexableNum::total_cmp
). - Replaced all uses for
PartialOrd::partial_cmp
withIndexableNum::total_cmp
to avoid panics whenpartial_cmp
returnsNone
(e.g., if float is a NaN) and to eliminate branch in compare.
- Fixed
PlineSource::remove_redundant
to 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-8
forf32
andf64
values) then it is more aggressive in removing vertexes. - Fixed pline
find_intersects
function to use epsilon parameter in all cases. - Fixed boolean operation bugs caused by
line_circle_intr
numerical 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_start
to 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_redundant
panic when there was more than 2 equal points at start (#26).
- Added CHANGELOG.md file for tracking changes and releases.
- New traits
PlineSource
,PlineSourceMut
, andPlineCreation
for sharing methods across different polyline data views (for example sub views/selections over polylines or direction inversion). PlineViewData
andPlineView
types.PlineView
implementsPlineSource
trait allowing for flexible views over polyline data to be processed with all the shared behavior/methods.PlineViewData
holds 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
PlineViewData
andPlineView
types. - Changed polyline methods that returned
Cow
types to returnOption
types 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_eps
epsilon value in intersect functions. - Changed
pline_seg_intr
function 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_overlapping
parameter toall_self_intersects_as_basic
function.
- 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_segments
instead).Polyline::len
method removed (usePlineSource::vertex_count
instead).PolylineSlice
trait andOpenPlineSlice
type (covered by new view types and polyline traits).PolylineSlice::stitch_onto
andPolylineSlice::to_polyline
removed, to get same functionality construct the view withPlineData::view
and pass it toPlineSourceMut::extend_remove_repeat
orPlineCreation::create_from_remove_repeat
.