Skip to content

Implementing a simple renderer for quadratic Bézier curves using Raph Levien's method for converting them to lines

License

Notifications You must be signed in to change notification settings

AlexandruIca/FlatteningQuadraticBezierCurves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flattening Quadratic Bézier Curves

Here I've implemented the algorithm presented by Raph Levien here and used it to render a few glyphs from some TrueType fonts. Here are 3 glyphs:

Glyph '@' Glyph 'F' Glyph 'W'

I've also implemented the De Casteljau method and rendered the same glyphs with it (images named glyph_<index>_recursive_subdivision). The differences are practically invisible, but Levien's method requires less number of segments generated and is much faster.

Reproduce the results

As long as you have Rust installed, to build this project and see the outputs you only need to:

git clone https://github.com/AlexandruIca/FlatteningQuadraticBezierCurves
cd FlatteningQuadraticBezierCurves/

cargo run

# Now a bunch of `.png`s will be generated and you can see the results for yourself

If you use Nix, you can just nix-shell inside this repo and you're good to go.

About

Implementing a simple renderer for quadratic Bézier curves using Raph Levien's method for converting them to lines

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published