https://github.com/arlk/bezier.jl
Bezier curve evaluation and subdivision
https://github.com/arlk/bezier.jl
bezier evaluation julia subdivision
Last synced: about 1 year ago
JSON representation
Bezier curve evaluation and subdivision
- Host: GitHub
- URL: https://github.com/arlk/bezier.jl
- Owner: arlk
- License: other
- Created: 2018-03-02T03:31:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T21:03:35.000Z (over 8 years ago)
- Last Synced: 2025-02-02T14:47:17.279Z (over 1 year ago)
- Topics: bezier, evaluation, julia, subdivision
- Language: Julia
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Bezier
[](https://travis-ci.org/arlk/Bezier.jl) [](https://codecov.io/gh/arlk/Bezier.jl)
This package provides evaluation and subdivision algorithms for arbitary order Bezier curves.
## Usage
Evaluate curve at `0.5`:
```julia-repl
julia> pts = [0.0 1.0 2.0 3.0; 0.0 -1.0 2.0 0.0];
julia> evalbezier(pts, 0.5)
2-element Array{Float64,1}:
1.5
0.375
```
*Note*: You can perform evaluations much faster if you use [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl)
Evaluate curve at `0.1:0.01:1.0`:
```julia-repl
julia> evalbezier(pts, 0.1:0.01:1.0)
2×91 Array{Float64,2}:
0.3 0.33 0.36 0.39 0.42 … 2.88 2.91 2.94 2.97 3.0
-0.189 -0.196779 -0.202752 -0.206973 -0.209496 0.216576 0.166743 0.114072 0.058509 0.0
```
Subdivide curve at `0.5`:
```julia-repl
julia> β₁, β₂ = subdivide(pts, 0.5)
([0.0 0.5 1.0 1.5; 0.0 -0.5 0.0 0.375], [1.5 2.0 2.5 3.0; 0.375 0.75 1.0 0.0])
```