After recently taking it upon ourselves, Tanner, Weregoose, and myself recently made a couple of Bezier curve programs that would make a curved line of some sort based on given point inputs.

As I understand, there are two types of Bezier curves, with no names to differentiate between the two: one that becomes more accurate with smaller increments in percentages (first picture below) and the other that should become more accurate with more recursions (second picture).

...and...


Tanner and I had both tried the latter Bezier curve program, and got some weird results. After about 100 iterations, the curved line becomes more so a straight line between the first and last points. We expected it to become more accurate with more iterations, and it does, but after a certain point, it gets further from the expected curve.

Any opinions on whether the problem is with the programs, or it's because of this method of making a curve?
For the interested, this is the version I've been toying with (based around MufinMcFlufin's source here):

[.8xp]

Code:
PROGRAM:BEZIER
:Ans→L1
:dim(Ans→D
:L1(Ans-1→U
:L1(D→V
:FnOff
:ClrDraw
:GridOff
:AxesOff
:Plot1(Scatter,L1,L1
:ZoomStat
:PlotsOff
:ΔX→S
:ΔY→T
:For(A,2,D,2
:Text(round((Ymax-L1(A))/Ans,0)-4,round((L1(A-1)-Xmin)/S,0)-1,"▫",1+.5(D-A
:End
:For(A,0,1,(S/Ans)^5
:L1
:Repeat 2=dim(Ans
:seq(AAns(B-2)+(1-A)Ans(B),B,3,dim(Ans
:End
:Line(U,V,Ans(1),Ans(2
:Line(S+U,V,S+Ans(1),Ans(2
:Line(U,T+V,Ans(1),T+Ans(2
:Ans→L2
:Ans(1→U
:L2(2→V
:End
:Line(U,V,L1(1),L1(2
:Line(S+U,V,S+L1(1),L1(2
:Line(U,T+V,L1(1),T+L1(2

Syntax: input:prgmBEZIER
  • {0,0,0,1,1,1,1,0} for a semicircle
  • {3,3,8,8,0,8,5,3} for a loop
  • rand(6) for a random quadratic curve
  • rand(8) for a random cubic curve
  • rand(2n+2) for a random n-order curve
Ooooh, that looks very cool; I feel like trying to write one of these programs myself! And of course my initial reflex to try to perform optimization is pretty futile when the code in question is written or at least modified by Weregoose. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement