Anonymous user
Bitmap/Bézier curves/Cubic: Difference between revisions
m
Fixed lang tags.
m (Fixed lang tags.) |
|||
Line 6:
=={{header|Ada}}==
<lang ada>procedure Cubic_Bezier
( Picture : in out Image;
P1, P2, P3, P4 : Point;
Line 30 ⟶ 29:
Line (Picture, Points (I), Points (I + 1), Color);
end loop;
end Cubic_Bezier;</lang>
The following test
<lang ada> X : Image (1..16, 1..16);
begin
Fill (X, White);
Cubic_Bezier (X, (16, 1), (1, 4), (3, 16), (15, 11), Black);
Print (X);</lang>
should produce output:
<pre>
Line 65 ⟶ 61:
{{works with|ALGOL 68G|Any - tested with release mk15-0.8b.fc9.i386}}
<!-- {{does not work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release 1.8.8d.fc9.i386 - '''pragmat''' '''read''' is not part of algol68rs}} -->
<lang
cubic bezier OF class image :=
Line 192 ⟶ 188:
This subroutine should go inside the <code>RCImagePrimitive</code> module (see [[Bresenham's line algorithm]])
<lang fortran>
=={{header|J}}==
Line 247 ⟶ 243:
'''Example usage:'''
<lang j>
=={{header|OCaml}}==
Line 358 ⟶ 354:
=={{header|R}}==
<lang R># x, y: the x and y coordinates of the hull points▼
▲# x, y: the x and y coordinates of the hull points
# n: the number of points in the curve.
bezierCurve <- function(x, y, n=10)
Line 397 ⟶ 392:
y <- 1:6
plot(x, y, "o", pch=20)
points(bezierCurve(x,y,20), type="l", col="red")</lang>
=={{header|Ruby}}==
Line 515 ⟶ 509:
{{TI-image-task}}
<
Local i,t,u,prev,pt
0 → pt
Line 527 ⟶ 521:
EndIf
EndFor
EndPrgm</
|