Commit Graph

21 Commits

Author SHA1 Message Date
Hannah Li a9b63f2a4c Implement self-intersection function for Beziers (#740)
* Initial commit and refactor reduce

* Refactor reduce to get t values

* Implement self intersection

* Return pairs of t values

* Fix results for the case where self is linear and other is not, address other comments

* Update a rustdoc comment

* Address final PR comments
2022-07-31 22:46:33 -04:00
Hannah Li c00f520351 Handle intersections between two bezier curves (#735)
* Refactor intersections function

* Implement intersect for quadratic and cubic bezier curves

* Return t value instead of point

* Change project return the t value

* Add error threshold for curve intersection

* Refactor to use if let statements and improve comments

* Refactor intersection helper to return vector, other minor name/text changes

* Rename function

* Minor change

* Minor fixes

* Add missing test tag

* Address comments

* Adjust comment

* Change function call

* Edit comments
2022-07-29 22:37:24 -04:00
Jackie Chen 8c1e6455eb Implement curvature function in Bezier math library (#725)
* bezier curvature

* change comment

Co-authored-by: Jackie Chen <jackiechen73>
2022-07-29 21:58:16 -04:00
Hannah Li 30e5d3c8ec Implement Bezier scale and offset (#718)
* Implement scale and offset

* Add tests for offset and reduce

* Added scale to documentation page

* address comments

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Thomas Cheng <Androxium@users.noreply.github.com>
Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com>
2022-07-28 21:07:24 -04:00
Linda Zheng 19483a9a35 Implement function to find inflection points of a Bezier curve (#712)
* Implement inflection function for bezier-rs

* Swapped to explicit inflection formula

Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca>

* Address Rob's comments

* Fix axis align

Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com>

* Address Keavon's comments

* Fix linting

Co-authored-by: Robert Nadal <Robnadal44@gmail.com>
Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-27 22:52:50 -04:00
Linda Zheng c05c93c8a2 Implement bounding box function for bezier-rs (#726)
* Implement bounding box function for bezier-rs

* Fix eslint errors

Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com>

* Rename bbox to bounding_box

* Address Keavon's comments

* Fix eslint issue

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com>
2022-07-27 22:27:50 -04:00
Rob Nadal 4ebdd1abb1 Added Subpaths to bezier-rs (#730)
* Added Subpath constructor, iterator and length

* Asserted that subpaths of len < 2 cannot be closed. Added len() and comments

* Added subpath to_svg(), made structs public, made quadratic use either in_handle or out_handle

* add bezier handles

* Added basic interactivity and index traits

* Added SubPath interactivity

* Added svg styling

* Broke subpath impl across multiple files. More sylistic changes per review

* Fixed format error

* Added closed subpath to documentation page

* Modified subpath to_svg to use functional style

* Stylistic changes per review

* Fixed build errors

* More sylistic changes per review

* Moved svg commands to constants

* Moved formatting for svg arguments to ToSVGOptions

* Renamed files in git

* Even more stylistic changes per review
2022-07-27 17:30:08 -04:00
Jackie Chen 004c2aeff6 Implement bezier library's De Casteljau points function (#715)
* pre-rebase

* broken wasm

* hull lines

* update rust lib description

* update comments, handle match statement better, pass Point type to vue

* cleanup

* add linear case

* More idiomatic code

* Further simplifications to the algorithm and removal of more heap allocations

* Rename to de_casteljau_points and use colors for the iterations

* Small comment changes

* Improve colors

Co-authored-by: Jackie Chen <jackiechen73>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Hannah Li <hannahli2010@gmail.com>
2022-07-27 00:35:43 -04:00
Keavon Chambers dc0b38750c Update npm dependencies 2022-07-23 15:31:02 -07:00
Oliver Davies 03633bf313 Rename vector components to match new terminology (#719)
* Renamed VectorAnchor, VectorShape and VectorControlPoint. Also fixed other naming inconsistencies.

* Renamed messages relating to vector and updated naming in several tools

* Renamed comments + caught a few areas I had missed.

* Caught a few more incorrect names

* Code review pass

* Review changes

* Fixed warning

* Additional review feedback

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-12 17:59:06 -07:00
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
Rob Nadal b01f76f097 Implement Bezier curve reduce function (#711)
* fixed extrema bug and added reduce impl

Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com>
Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca>
Co-authored-by: Hannah Li <hannahli2010@gmail.com>

* Stylistic changes related to reduce

* Fixed reduce splitting bug causing panic

* Added shortcuts and simplified reduce

* Stylistic changes per review

* address comments

* Removed color gradient function and added consts

* Tweaks

* Change colors faster

* Don't drop on mouseout

Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
Co-authored-by: Rob Nadal <RobNadal@users.noreply.github.com>
Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca>
Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-06 14:20:28 -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 0036d12b99 Fix problem with compiling bezier-rs-wasm (#710)
Fix problem with compiling bezier-rs-wasm, remove unnecessary file

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-07-01 16:58:07 -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
Hannah Li 4eaffd0e5a Bezier split and trim implementation (#680)
* Added split implementation and UI

Co-authored-by: Thomas Cheng <Androxium@users.noreply.github.com>

* Added bezier split impl

* Adjust struct traits

* Implement trim and adjust FE code to handle multiple sliders per feature

Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
Co-authored-by: Rob Nadal <robnadal44@gmail.com>

* Fix edge case in trim and add rust doc comments

* Stylistic changes per review

* More stylistic changes per review

* replaced last explicit color usages

Co-authored-by: Robert Nadal <Robnadal44@gmail.com>
Co-authored-by: Thomas Cheng <Androxium@users.noreply.github.com>
Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
2022-06-27 19:33:56 -04:00
Hannah Li 5016abd971 Bezier derivative and normal implementation (#679)
* added ui for derivative impl

* Add derivative computation for bezier-rs library

* integrate devivative ui with library

* Add implementation for the normal function

* Update rustdoc comments

* Rename handles and getters, add tangent function

* Rename variables, address nits

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
Co-authored-by: Thomas Cheng <contact.chengthomas@gmail.com>
Co-authored-by: ll2zheng <Linda Zheng>
2022-06-23 17:03:48 -04:00
Hannah Li 9f76315bdc Beginnings of the bezier-rs math library (#662)
Co-authored-by: Thomas Cheng <35661641+Androxium@users.noreply.github.com>
Co-authored-by: Robert Nadal <Robnadal44@gmail.com>
Co-authored-by: ll2zheng <ll2zheng@uwaterloo.ca>
2022-06-16 20:50:58 -04:00