* Added typing to index.ts, tests to test.ts
* Update pnpm-lock.yaml after dependency updates
* Replace embedded arc.js with external TypeScript arc package
- Add arc@^0.2.0 (WIP bump) as dependency to replace embedded lib/arc.js
- Update import from './lib/arc.js' to 'arc' package
- Fix TypeScript type compatibility issues:
- Handle null properties with fallback to empty object
- Add proper type assertion for return value
- All tests pass (9/9) with new TypeScript arc.js integration
- Maintains 100% backward compatibility while adding full TypeScript support
* Remove arc.d.ts which is no longer needed, regenerate pnpm-lock
---------
Co-authored-by: mfedderly <24275386+mfedderly@users.noreply.github.com>
* add tests for multipolygon contained by polygon
* check for is every multipolygon inside polygon
---------
Co-authored-by: Martin Powlesland-Cook <mpowlesland-cook@denseair.net>
Co-authored-by: James Beard <james@smallsaucepan.com>
* fix boolean-contains and boolean-within isLineInPoly
* update esri-contains and esri-within diagrams
* check if line is contained in boundary after splitting on intersections
* fix line simply containes in polygon, and tidy up test examples
* split linestring segments on polygon before checking midpoints
* add explanatory comments and update docs
---------
Co-authored-by: samuelarbibe <samuel.arbibe@gmail.com>
Co-authored-by: James Beard <james@smallsaucepan.com>
* Remove unused marchingsquares dep in lockfile
* Bump serialize-javascript to 6.0.2
* Upgrade form-data to 4.0.5
* Bump cross-spawn to 6.0.6
* Bump axios to 1.13.2
* Upgrade glob@10 to 10.5.0
* Upgrade glob@11 to 11.1.0
* js-yaml@3 to 3.14.2
* js-yaml@4 to 4.1.1
* tmp@0.2 to 0.2.5
* brace-expansion@1 to 1.1.12
* brace-expansion@2 to 2.0.2
* @turf/nearest-point-on-line code simplifications
Before fixing behavioral bugs, making some non-behavior changing
cleanups:
- Removing unused distance calculations
- Cleaning up tuples and position variable use in main loop
- Removing unnecessary conditions and types for intersectPt (it will
always exist)
- Added return type to magnitude function
- Reduced duplicate calculations in return values for
nearestPointOnSegment
Fix @turf/nearest-point-on-line #2934 issue
Changed closest point determination logic to ensure that the correct
endpoint is returned in certain cases where the line segment spans more
than Pi radians.
Specific changes:
- Added normalize vector function
- Replaced inline coefficient calculations with existing vector
functions for readability
- Added geometric rationale comments for intermediate steps
- Added minimal failing test for #2934
- Replaced closest intersection point logic with dot product version
- Replaced closest endpoint distance logic with dot product version
(less calculations)
Fix @turf/nearest-point-on-line degenerate cases
Cross product usage leads to several degenerate edge cases that can
lead to spurious failures. This attempts to fix several of them:
- Clamp z-value before asin when converting to lng-lat
- Capture degenerate zero-vectors in the segment's normal from
coincident or antipodal points
- Early return from coincident points as this becomes a pt-pt distance
- Explicit throw from antipodal points as an infinite number of arcs
match
- Early return when the target is coincident with the segment's normal,
here all points are equidistant so choose the endpoint for consistency
@turf/nearest-point-on-line improve test
Improve test addressing degenerate line segment cases. These tests were
failing in browser but succeeding in Chrome. This test fix monkey
patches Node to capture any regressions.
* Fix @turf nearest-point-on-line incorrect endpoints
Two additional fixes:
- Caught an additional failure case widely separated points could
incorrectly return that the intersection point was inside the line
segment; added regression test for this case
- Elminated throw on antipodal points, instead returning that the point
lies directly on the line; added comment in function signature
mentioning this behavior
* Fix: @turf/nearest-point-on-line failing test
After changes, tests in @turf/point-to-polygon-distance were failing.
Issue confirmed to be due to single bit floating point difference and
updated to new output value.
Also fixed partially missing comment.
* Fix: @turf/nearest-point-on-line faililng test
9edc247a introduced another floating point precision issue that is fixed
here.
* @turf/shortest-path improve creation of point matrix for A* algorithm (#2943)
* Use 6 decimal digits as precision for test data
---------
Co-authored-by: James Beard <james@smallsaucepan.com>
* add non-passing test fixture
* make each step return correctly signed value
* call booleanPointInPolygon one less time
---------
Co-authored-by: James Beard <james@smallsaucepan.com>
* Reimplement @turf/isobands to clear up licensing issues around marchingsquares
* Add test case from issue #1084
---------
Co-authored-by: James Beard <james@smallsaucepan.com>
* Reimplement @turf/isolines to clear up the licensing concerns around marchingsquares.
---------
Co-authored-by: James Beard <james@smallsaucepan.com>