Advertisement
Guest User

DCJ

a guest
Nov 1st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // DeCasteljau Algorithm implementation
  2. function DCJ() {
  3.     return {
  4.         bezier3: function(t, a, b, c) {
  5.             var ab = {x: ((b.x-a.x) * t) + a.x,
  6.                       y: ((b.y-a.y) * t) + a.y};
  7.             var bc = {x: ((c.x-b.x) * t) + b.x,
  8.                       y: ((c.y-b.y) * t) + b.y};
  9.             var abbc = {x: ((bc.x-ab.x) * t) + ab.x,
  10.                       y: ((bc.y-ab.y) * t) + ab.y};
  11.             return abbc;
  12.         }
  13.     };
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement