(** 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.;; #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); do_list PutPt tValues; end ;; open_graph "";; DrawBezierCurve (PoV(100.,100.)) (PoV(150.,150.)) (PoV(400.,450.)) (PoV(400.,200.));;