Commit Graph

6 Commits

Author SHA1 Message Date
Hannah Li 00cc50d531 Support linear bezier curve segments in the Bezier math library (#717)
* Support Linear line segments, add linear section to interactive docs

* Fix regression, customize points in UI examples, add optional subdivisions to length, minor refactors

* Refactor ExamplePane, use better example curves

* Update consts.rs comments

* Code review changes

* Address PR comments

* Code review

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-08 17:41:15 -04:00
Hannah Li 6decc67571 Make certain Bezier function parameters optional and other refactors (#713)
* Make certain parameters optional

* Use builder pattern for project function's optional parameters

* Address comments posted in bezier-math-lib discord channel

* Minor changes to text

* Address PR comments

* Fix index.html

* Nit

* Replace builder pattern with simple struct

* Move constants to a separate file

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-06 14:02:52 -04:00
Hannah Li 3c2fff4465 Implement function to find intersections between a Bezier and a linear line (#708)
* Implement line intersection for quadratics, begin work for cubic

* Implement line intersection for cubic beziers, add tests for cubic root finding

* Rename function and update comments

* Minor refactor and adjust comments

* Address PR comments
2022-07-04 19:29:25 -04:00
Rob Nadal c343aaa3ab Implement bezier local_extrema function (#693)
* Implement backend of extrema in bezier-rs

* Added extrema frontend

* Added extrema interface

* Wrapped extrema in filter function to remove points not on the curve

* Saved intermediate results while computing extrema

* Fixed extrema bug when a in cubic formula is 0

* Removed extra prints

* Fixed quadratic extrema regression

* Moved helper functions to utils file

* Fixed bug in solve linear

* Stylistic changes per review

* Sentence comments

Co-authored-by: Linda Zheng <thelindazheng@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-02 02:00:51 -04:00
Hannah Li 3ab47418d2 Implement function that projects to a Bezier curve (#688)
* UI section for the projection function

* added bezier project impl

* Fix project function and add test for it

* Search method

* Re-use comptued distances

* Update comments

* rebase project changes

* clean up tests and library code

* use built-in functions and destructure syntax

* Remove redundant project implementation

* Fix typo, add lut size as parameter and add constant

* address comments

Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
2022-07-01 18:22:17 -04:00
Hannah Li 2e3e079982 Implement functions to create a Bezier that goes through 3 specified points (#687)
* Implement quadratic and cubic from points

* Catch edge cases and integrate `t` slider

* Add 2 sliders for cubic

* Create utils file for bezier-rs and address other PR comments

* Rename variable and remove unnecessary ids

* Update rustdoc comments and rename variables

* Remove unnecessary file and refactor options for drawing beziers

* Address PR comments

* Update quadratic_through_points description

* Add wasm-pack to dependencies and change from spaces to tabs for indents

* Change strut to midpoint_separation, adjust sliders and section name

* Minor refactor
2022-06-29 20:52:09 -04:00