Giter Site home page Giter Site logo

bezier.jl's Introduction

Bezier

Build Status

Interpolation for arbitrary order Bézier curves in julia

Linear interpolation between two points with bezier(t, P1, P2)

  • P1 coordinate for one point
  • P2 coordinate for second point
  • 0 ≤ t ≤ 1 defines how close to P1 vs P2 to interpolate
julia> using Bezier

julia> bezier(0.25, [1. 2], [3. 4]) # This is a quarter of the way between [1 2] and [3 4]
1x2 Array{Float64,2}:
 1.5  2.5

julia> bezier(0.5, [1. 2], [3. 4]) # This finds the midpoint between [1 2] and [3 4]
1x2 Array{Float64,2}:
 2.0  3.0

julia> bezier(0.8, [1. 2], [3 4]) # This is 80% of the way from [1 2] to [3 4]
1x2 Array{Float64,2}:
 2.6  3.6

Interpolate between an Array of points using bezier(t, ::Array{Array{FloatingPoint,1},1}

julia> bezier(0.5, Vector{FloatingPoint}[[0., 0], [10, 10], [20, 0]]) # quadratic interpolation
1-element Array{Array{FloatingPoint,1},1}:
 FloatingPoint[10.0,5.0]

Or as a matrix (where each row represents a point) using bezier(t, ::Array{FloatingPoint,2}

julia> bezier(0.5, [0. 0; 5 5; 10 0; 15 5]) # cubic interpolation as a matrix
1x2 Array{Float64,2}:
 7.5  2.5

bezier.jl's People

Contributors

catawbasam avatar jbn avatar rawrgrr avatar thomastanck avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.