Commit Graph

37 Commits (e0f212a334779cb1a0fea2e0d435f7119ffba355)

Author SHA1 Message Date
Andrew Port e0f212a334 make paths and path semgents hashable 2021-09-22 21:19:13 -07:00
Andrew Port 8dc12d4efc add delta tolerance to all assertAlmostEquals that don't have one 2021-06-27 22:30:56 -07:00
tatarize 3a1fe8695d
Bug Corrections. Closes #113, #95, #94, and #71 (#136)
* Closes #113

Previous fix stopped working because numpy is more liberal dividing by zero and returning nan values.

* Closes #71

* Closes #95

* Closes #94
2021-01-16 20:08:58 -08:00
Andrew Port 561c89ad47 fix fail test (test assumed untrue number of intersections) 2020-12-08 18:45:35 -08:00
Andrew Port ee58270f66 fix incorrectly written assertTrue tests 2020-12-08 18:38:51 -08:00
Andrew Port 30f517e735 fix Arc.center being nan cause of switch to np.sqrt raising different error than math.sqrt 2020-12-08 18:21:24 -08:00
tatarize b3d9544624
Approximate Arcs With Beziers (#130)
* Approximate Arcs With Beziers

* Quadratic in documentation.

* Test Coverage, approximate arcs.
2020-12-01 18:37:15 -08:00
Andy Port c89c68f421 speed up randialrange for Line objects 2020-07-01 22:31:57 -07:00
Sebastian Kuzminsky 685f9a6eaf
fix Arc/Arc intersections (#110)
* add some failing Arc.intersect(Arc) tests

* implementing Arc.intersect(Arc)

This commit adds special handling in Arc.intersect() when the other
segment is an Arc, and when both segments are circular and non-rotated.

This particular case is common, and quick and easy to solve algebraically.

This commit fixes the failing tests added in the previous commit.
2020-06-19 19:40:38 -07:00
David Romero 90f8f76185
Method for checking if one path is inside another path (#105)
* Added method is_contained_by to the Path class

* Adding a requirements.txt file

Signed-off-by: David Romero <dromero.fisica@gmail.com>

* Correcting tests of is_contained_by
2020-06-19 19:36:22 -07:00
Sebastian Kuzminsky 2eb8fb62ed
test: show arguments that failed, to aid debugging (#83) 2020-06-19 18:47:04 -07:00
taoari c7b6c030a6
relative path support (#81)
* relative path support

* add test for path.d(rel=True)

* add path test to test_path.py
2020-06-19 18:43:29 -07:00
Sebastian Kuzminsky b37e74f5f3 Update Path.area to work with Arc segments (#65)
* add some tests of Path.area()

These tests currently fail because area() doesn't deal with Arc segments.
Fix in the following commit.

* make Path.area() approximate arcs

Fixes #37.

* Path.area(): fixup tabs/spaces for python3

* added asin to imports

* added asin to imports

* minor improvements to style, performance, and docstring
2018-11-04 21:40:56 -08:00
Sebastian Kuzminsky 2feb3c92b5 Arc line intersect, 3rd try (#64)
* add Line.point_to_t() and tests

These tests don't print anything while they run, and they use use the
assert() helpers from the unittest module.

* add Arc.point_to_t() and tests

These tests don't print anything while they run, and they use use the
assert() helpers from the unittest module.

* add a bunch of failing arc/line intersection tests

This commit contains a bunch of failing arc/line intersections that I
and other people have run into.

These tests don't print anything while they run, and they use use the
assert() helpers from the unittest module where possible.

All these tests are fixed in the following commit.

* better implementation of Arc.intersect(Line)

Fixes mathandy/svgpathtools#35.

This commit fixes all the arc/line intersection test cases added in the
previous commit.

This implementation provides special handling in Arc.intersect() when
`self` is a non-rotated Arc and `other_seg` is a Line.  In this case
it uses the straight-forward closed-form solution to identify the
intersection points.

Rotated Arcs and Arcs intersecting with non-Line objects still use
the pre-existing intersection code, that part is totally untouched by
this commit.
2018-11-04 20:55:17 -08:00
Andy Port 165372562e
Revert "Arc line intersect, take 2 (#60)" (#63)
This reverts commit 2da39e4c02.
2018-08-22 00:27:55 -07:00
Sebastian Kuzminsky 2da39e4c02 Arc line intersect, take 2 (#60)
* add Line.point_to_t() and tests

* add Arc.point_to_t() and tests

* add a bunch of failing arc/line intersection tests

This commit contains a bunch of failing arc/line intersections that I
and other people have run into.

All these tests are fixed in the following commit.

* better implementation of Arc.intersect(Line)

Fixes mathandy/svgpathtools#35.

This commit fixes all the arc/line intersection test cases added in the
previous commit.

This implementation provides special handling in Arc.intersect() when
`self` is a non-rotated Arc and `other_seg` is a Line.  In this case
it uses the straight-forward closed-form solution to identify the
intersection points.

Rotated Arcs and Arcs intersecting with non-Line objects still use
the pre-existing intersection code, that part is totally untouched by
this commit.
2018-08-22 00:19:05 -07:00
Andy 7fc7e45113 fixed false error raised when scipy not installed 2018-07-09 21:40:00 -04:00
Andy fb916596e2 fixed scale 2018-07-06 23:00:25 -04:00
Andy fd521748fa fixed scaled (before cleanup) 2018-07-06 22:59:28 -04:00
Andy fd95b5609f partially fixed scale fcn and improved tests 2018-06-08 22:13:18 -07:00
Andy Port 304c0bbe1d
improved `scale` related tests 2018-05-30 19:30:24 -07:00
Orion Elenzil ee656c7de0 refactor `scale()` and `scaled()` to `scale_uniform()` and `scaled_uniform()` 2018-05-30 10:54:56 -07:00
Andy Port eafe3682b9
altered so lines aren't (much) over 79 characters
Note: this is mostly unrelated to changes requested by @playi
2018-05-22 19:34:56 -07:00
Andy Port 6394415108
minor aesthetic change 2018-05-22 19:22:09 -07:00
Orion Elenzil 1ba9d45b35 unit test for new scale() and scaled() path transformation. tests all current segment types, composite paths, etc 2018-05-22 15:48:45 -07:00
Sebastian Kuzminsky cc4573ffc7 add a failing Line.intersect(Line) test
I introduced this bug recently, sorry!  The bug is fixed in the following
commit.
2018-01-20 20:45:47 -07:00
Sebastian Kuzminsky de600f9b91 rename test to make room for more 2018-01-20 20:36:06 -07:00
Sebastian Kuzminsky 847b270bc2 add a failing Line.intersect(Line) test
These two lines are parallel but do not intersect.  Line.intersect()
finds an incorrect intersection.
2018-01-06 23:05:55 -07:00
Andy bf95944c49 moved test for checking if `Arc()` throws `acos` domain error due to numerical error 2017-12-26 00:57:48 -05:00
Andy 60d67923b6 fix issue#15 Path.cropped() bug, and more
-also fixed <path>.cropped(1, 0) bug (now raises AssertionError)
-also now Path.cropped() raises AssertionError if given negative values
2017-03-30 01:38:27 -07:00
Andy 4ec69a4cff remove empty `pathtools.py` and move tests from `test_pathtools.py` to `test_path.py` 2017-03-24 00:18:22 -07:00
Andy 1655b77d15 removed builtins imports 2017-02-28 23:34:29 -08:00
Andy 8815ddcd52 futurized for Python 3 compatibility
and some other minor changes of no effect
2017-02-28 23:04:37 -08:00
Andy 0cf57d4276 label swap/fix -- no effect 2017-02-28 18:29:19 -08:00
Andy 19841906f7 added some unittests for the .intersect() methods 2017-02-20 22:57:59 -08:00
Andy fcdb61c39e minor change to in-line comments
Note only is this true of tests left from svg.path but also those
written by me.
2017-02-20 17:21:53 -08:00
Andy 08e8dc71ff improve distribution to PyPI
Now svg files, readme, unit tests, and license included in PyPI dis
2016-10-29 00:35:51 -07:00