(** Les courbes de Bézier **) type pointorvector=PoV of (float*float);; let cValues nbPts= let step=1./.nbPts in let rec rValues t l= let t2=t*.t in let t3=t2*.t in let ct=1.-.t and ct2=1.-.2.*.t+.t2 and ct3=1.-.3.*.t+.3.*.t2-.t3 in if t>1. then l else rValues (t+.step) ((t3,3.*.t2*.ct,3.*.t*.ct2,ct3)::l) in rValues 0. [] ;; let tValues=cValues 200.;; #load "graphics.cmo";; open Graphics;; let drawBeziercurve (PoV(x1,y1)) (PoV(x2,y2)) (PoV(x3,y3)) (PoV(x4,y4)) = let putPt (x,y,z,t)= lineto (int_of_float(x1*.x+.x2*.y+.x3*.z+.x4*.t)) (int_of_float(y1*.x+.y2*.y+.y3*.z+.y4*.t)) in begin moveto (int_of_float x1) (int_of_float y1); List.iter putPt tValues; end ;; open_graph "";; drawBeziercurve (PoV(100.,100.)) (PoV(150.,150.)) (PoV(400.,450.)) (PoV(400.,200.));;