Bitmap/Bézier curves/Quadratic: Difference between revisions
Content deleted Content added
m Fixed lang tags. |
|||
Line 6:
=={{header|Ada}}==
<lang ada>procedure Quadratic_Bezier
( Picture : in out Image;
P1, P2, P3 : Point;
Line 29 ⟶ 28:
Line (Picture, Points (I), Points (I + 1), Color);
end loop;
end Quadratic_Bezier;</lang>
The following test
<lang ada> X : Image (1..16, 1..16);
begin
Fill (X, White);
Quadratic_Bezier (X, (8, 2), (13, 8), (2, 15), Black);
Print (X);</lang>
should produce;
<pre>
Line 129 ⟶ 125:
(This subroutine must be inside the <code>RCImagePrimitive</code> module, see [[Bresenham's line algorithm#Fortran|here]])
<lang fortran>
=={{header|Haskell}}==
Line 272 ⟶ 268:
{{TI-image-task}}
<
Local i,t,u,prev,pt
0 → pt
Line 284 ⟶ 280:
EndIf
EndFor
EndPrgm</
=={{header|Vedit macro language}}==
Line 292 ⟶ 288:
Constant recursion depth is used here. Recursion depth of 5 seems to give accurate enough result in most situations. In real world implementations, some adaptive method is often used to decide when to stop recursion.
<lang vedit>// Daw a Cubic bezier curve
// #20, #30 = Start point
// #21, #31 = Control point 1
Line 325 ⟶ 320:
Call("DRAW_LINE")
}
return</lang>
|