Bitmap/Bézier curves/Quadratic: Difference between revisions

Content deleted Content added
Factor
m →‎{{header|Factor}}: Added USING:
Line 122:
Some code is shared with the cubic bezier task, but I put it here again to make it simple (hoping the two version don't diverge)
Same remark as with cubic bezier, the points could go into a sequence to simplify stack shuffling
<lang factor>ThisUSING: givesarrays akernel functionlocals math math.functions
rosettacode.raster.storage sequences ;
IN: rosetacode.raster.line
 
! This gives a function
:: (quadratic-bezier) ( P0 P1 P2 -- bezier )
[ :> x
Line 135 ⟶ 139:
: points-to-lines ( seq -- seq )
dup rest [ 2array ] 2map ;
: draw-lines ( {R,G,B} points gadgetimage -- )
[ [ first2 ] dip draw-line ] curry with each ;
:: bezier-lines ( {R,G,B} P0 P1 P2 gadgetimage -- )
100 t-interval P0 P1 P2 (quadratic-bezier) map
points-to-lines
{R,G,B} swap gadgetimage draw-lines ;
</lang>
 
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}