GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — smallbasic.github.io/samples/node/107.bas at master · smallbasic/smallbasic.github.io Expand file tree/ Copy path107.basMore file actions 81 lines (74 loc) · 1.46 KB / Copy path107.basFile metadata and controls81 lines (74 loc) · 1.46 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 ''' Bezier_pen '' '' with Pen/Mouse '' for SmallBasic-v0.9.0.3 '' on Win98se, by Ted Clayton '' references: '' '' "Learning Mathematics with Micros" '' by A. Oldknow & D. Smith, p.81 '' '' Sketch.sb, for Pen/Mouse code ? "Pick a line by left-clicking" ? "two points on the screen." ? ? "Then, pick a 3rd point, to" ? "the side of the line. The" ? "line will rubber-band toward," ? "but not to, the new point." ? ? "To dynamically rubber-band" ? "the line; left-click-hold," ? "and move the mouse." ? ? "Uses ''binomial probability" ? "distribution'', a.k.a.," ? "''Pascal''s Triangle''." ? ? "''q'' to quit" dim P1(1) '' end-point #1 dim P2(1) '' #2 dim Cp(1) '' control-point dim Bp(1) '' Bezier-curve point pen on '' pick 2 points gosub WaitForPen P1(0)=pen(4) '' end-point #1 P1(1)=pen(5) circle P1(0), P1(1), 3 color 12 gosub WaitForPen P2(0)=pen(4) '' end-point #2 P2(1)=pen(5) circle P2(0), P2(1), 3 color 10 repeat gosub WaitForPen cls '' control-point Cp(0)=pen(4) Cp(1)=pen(5) circle P1(0), P1(1), 3 color 12 circle P2(0), P2(1), 3 color 10 circle Cp(0), Cp(1), 3 color 9 pset P1(0), P1(1) '' calculate, plot Bezier curve '' uses Pascal''s Triangle for t=0.05 to 1 step 0.05 s=1-t k1=s*s k2=2*s*t k3=t*t for i=0 to 1 Bp(i)=k1*P1(i)+k2*Cp(i)+k3*P2(i) next i line Bp(0), Bp(1) next t line P2(0), P2(1) k=inkey until k="q" pen off end label WaitForPen while pen(0)=0 k=inkey if k="q" then end wend return' |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |