How to resolve the algorithm Bitmap/Bézier curves/Cubic step by step in the TI-89 BASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Bitmap/Bézier curves/Cubic step by step in the TI-89 BASIC programming language
Table of Contents
Problem Statement
Using the data storage type defined on this page for raster images, and the draw_line function defined in this other one, draw a cubic bezier curve (definition on Wikipedia).
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Bitmap/Bézier curves/Cubic step by step in the TI-89 BASIC programming language
Source code in the ti-89 programming language
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
You may also check:How to resolve the algorithm Compile-time calculation step by step in the Objeck programming language
You may also check:How to resolve the algorithm Pell's equation step by step in the Nim programming language
You may also check:How to resolve the algorithm Order by pair comparisons step by step in the F# programming language
You may also check:How to resolve the algorithm Superpermutation minimisation step by step in the Scala programming language
You may also check:How to resolve the algorithm Pan base non-primes step by step in the Pascal programming language