Bitmap/Bézier curves/Cubic: Difference between revisions
Content added Content deleted
m (→{{header|Tcl}}: add links to referenced pages) |
(→TI-89 BASIC: new example) |
||
Line 339: | Line 339: | ||
[[Image:Tcl_cubic_bezier.png]] |
[[Image:Tcl_cubic_bezier.png]] |
||
=={{header|TI-89 BASIC}}== |
|||
{{TI-image-task}} |
|||
<pre style="font-family:'TI Uni'">Define cubic(p1,p2,p3,p4,segs) = Prgm |
|||
Local i,t,u,prev,pt |
|||
0 → pt |
|||
For i,1,segs+1 |
|||
(i-1.0)/segs → t © Decimal to avoid slow exact arithetic |
|||
(1-t) → u |
|||
pt → prev |
|||
u^3*p1 + 3t*u^2*p2 + 3t^2*u*p3 + t^3*p4 → pt |
|||
If i>1 Then |
|||
PxlLine floor(prev[1,1]), floor(prev[1,2]), floor(pt[1,1]), floor(pt[1,2]) |
|||
EndIf |
|||
EndFor |
|||
EndPrgm</pre> |