Txt

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Txt as PDF for free.

More details

  • Words: 3,933
  • Pages: 19
private sub drawpiechart() dim i as long with draw1 'graph is a pie chart .graphtype = dgtpie 'set some properties based on the check boxes .showlabel = check6.value .shownumbers = check7.value .showpercent = check8.value .showlegend = check9.value .userndcolor = check10.value 'add the data values for i = 1 to 5 .adddata "item" + str(i), datavalues(i), colours(i - 1) next i 'draw the graph .drawgraph end with end sub

new chart

' print a msflexgrid control's data across multiple pages ' vertically and horizontally. private sub printflexgridmultipage(byval flx as msflexgrid, _ byval l_margin as single, byval t_margin as single, _ byval r_margin as single, byval b_margin as single, _ byval page_x as single, byval page_y as single) dim r as integer dim page_r as integer ' print the rows. r = 0 page_r = 0 do while r < flx.rows ' print the next set of rows. printflexgridrows flx, r, _ l_margin, t_margin, r_margin, b_margin, _ page_x, page_y, page_r page_r = page_r + 1 loop end sub

subroutine printflexgridrows prints rows in the flexgrid. if there are too many

columns to fit on a single page, it prints multiple pages arranged horizontally. it starts at row start_row and leaves start_row pointing to the next row to print when it is done. the routine loops through the rows starting with start_row to see how tall they are and determine how many rows will fit on a page. next the routine sets c = 0 and calls subroutine printflexgridrowcolumns to print rows start_row through stop_row, starting at column c. when printflexgridrowcolumns returns, it sets c to the next column that has not been printed. subroutine printflexgridrows continues calling printflexgridrowcolumns until all of the columns have been printed.

' print the horizontal pages for the next set of rows that ' will ' fit on a page vertically. start with row start_row. ' leave start_row pointing to the first row after those ' printed. private sub printflexgridrows(byval flx as msflexgrid, _ byref start_row as integer, byval l_margin as single, _ byval t_margin as single, byval r_margin as single, _ byval b_margin as single, byval page_x as single, byval _ page_y as single, byval page_r as integer) dim ymax as single dim c as integer dim stop_row as integer dim page_c as integer with flxdata ' see which rows will fit on this page. ' start with the first row. stop_row = start_row ymax = t_margin + .rowheight(stop_row) + 2 * vgap do if stop_row + 1 >= .rows then exit do if ymax + .rowheight(stop_row + 1) + 2 * vgap > _ b_margin then exit do ymax = ymax + .rowheight(stop_row + 1) + 2 * _ vgap stop_row = stop_row + 1 loop ' print horizontal groups of pages. c = 0 page_c = 0 do while c < .cols printflexgridrowcolumns flx, start_row, _ stop_row, c, _ l_margin, t_margin, r_margin, b_margin, _ page_x, page_y, page_r, page_c page_c = page_c + 1 loop end with ' set start_row and page_r for return. page_r = page_r + 1 start_row = stop_row + 1

end sub

subroutine printflexgridrowcolumns prints rows start_row through stop_row, starting at column start_col. first it loops through columns to see how many will fit on the page. it then prints those rows and columns, and draws lines between the cells. ' print the horizontal pages for the rows start_row through ' stop_row ' starting with column start_col. ' leave start_col pointing to the first column after those ' printed. private sub printflexgridrowcolumns(byval flx as _ msflexgrid, byval start_row as integer, byval stop_row _ as integer, byref start_col as integer, byval l_margin _ as single, byval t_margin as single, byval r_margin as _ single, byval b_margin as single, byval page_x as _ single, byval page_y as single, byval page_r as _ integer, byval page_c as integer) dim xmax as single dim ymax as single dim r as integer dim c as integer dim stop_col as integer dim x as single dim y as single dim page_txt as string ' print the page number. page_txt = "page (" & format$(page_r) & ", " & _ format$(page_c) & ")" printer.currentx = page_x - printer.textwidth(page_txt) printer.currenty = page_y printer.print page_txt; ' debug.print page_txt & ": "; with flxdata ' see which columns will fit on this page. ' start with the first column. stop_col = start_col xmax = l_margin + .colwidth(stop_col) + 2 * hgap do if stop_col + 1 >= .cols then exit do if xmax + .colwidth(stop_col + 1) + 2 * hgap > _ r_margin then exit do xmax = xmax + .colwidth(stop_col + 1) + 2 * hgap stop_col = stop_col + 1 loop ' print the cells that fit. ' debug.print start_row, stop_row, start_col, ' stop_col y = t_margin for r = start_row to stop_row x = l_margin

for c = start_col to stop_col '(debug) printer.circle (x, y), 40 'debug.print " (" & x + hgap & ", " & y ' + vgap & ")" printer.currentx = x + hgap printer.currenty = y + vgap printer.print .textmatrix(r, c); x = x + .colwidth(c) + 2 * hgap next c y = y + .rowheight(r) + 2 * vgap next r ' print a grid. ymax = y y = t_margin for r = start_row to stop_row '(debug) printer.line (l_margin, y)-step(60, ' 60), , b printer.line (l_margin, y)-(xmax, y) y = y + .rowheight(r) + 2 * vgap next r printer.line (l_margin, y)-(xmax, y) x = l_margin for c = start_col to stop_col '(debug) printer.line (x, t_margin)-step(60, ' 60), , b printer.line (x, t_margin)-(x, ymax) x = x + .colwidth(c) + 2 * hgap next c printer.line (x, t_margin)-(x, ymax) end with ' finish this page. printer.newpage ' set start_col for return. start_col = stop_col + 1 end sub

private sub command1_click() dim dim dim dim

oxl as object obook as object osheet as object ochart as object

' ' ' '

excel excel excel excel

application workbook worksheet chart

dim irow as integer dim icol as integer

' index variable for the current row ' index variable for the current row

const cnumcols = 10 const cnumrows = 2

' number of points in each series ' number of series

redim atemp(1 to cnumrows, 1 to cnumcols) 'start excel and create a new workbook set oxl = createobject("excel.application") set obook = oxl.workbooks.add set osheet = obook.worksheets.item(1) ' insert random data into cells for the two series: randomize now() for irow = 1 to cnumrows for icol = 1 to cnumcols atemp(irow, icol) = int(rnd * 50) + 1 next icol next irow osheet.range("a1").resize(cnumrows, cnumcols).value = atemp 'add a chart object to the first worksheet set ochart = osheet.chartobjects.add(50, 40, 300, 200).chart ochart.setsourcedata source:=osheet.range("a1").resize(cnumrows, cnumcols) ' make excel visible: oxl.visible = true oxl.usercontrol = true end sub dim data() as double dim i as long dim rng as range dim upperleftcell as string dim numbpoints as long upperleftcell = activecell.address numbpoints = 20 redim data(numbpoints - 1) for i = 0 to numbpoints - 1 data(i) = i + 1 next i set rng = range(range(upperleftcell), range(upperleftcell).offset(0, numbpoints _ - 1)) rng.value = data to insert the data as a column, you need a two-dimensional array. the routine for a column of data is below. declarations and such not shown are the same as those shown above. redim data(numbpoints - 1, 0) for i = 0 to numbpoints - 1 data(i, 0) = i + 1 next i set rng = range(range(upperleftcell), range(upperleftcell).offset(numbpoints -

1,_ 0)) rng.value = data simple graph now that we can put an array into a worksheet, let's see how to create a graph. one of the best ways to learn the excel commands is to use the macro recorder. select worksheet cells a1 to a20. turn on the macro recording by going to the menu tools > macro > record new macro. using the chart wizard, make a line chart from the data. view the macro by pressing alt+f8 and selecting the macro from the list. click edit. charts.add activechart.charttype = xllinemarkers activechart.setsourcedata source:=sheets("sheet1").range("a1:a20") activechart.location where:=xllocationasobject, name:="sheet1" for more flexibility, set the source of the graph to a variable rather than a string. use the range of the data on the worksheet. this allows you to change the graph data in code. in the code below, on the right hand side of the equation, the term range(upperleftcell) represents the upper left cell, and the term range(upperleftcell).offset(numbpoints, 0) represents the lower right cell of the outer range. set datarange = range(range(upperleftcell), range(upperleftcell)._ offset(numbpoints, 0)) activechart.setsourcedata source:= datarange, plotby:=xlcolumns setting the graph source this way allows you to create a graph with a variable number of points for a more general program. this code will place an array of data in the worksheet and then create a graph regardless of the size of the data or where the data is placed. upperleftcell = "a1" numbpoints = 50 ' put the data on the active sheet (one column) set datarange = range(range(upperleftcell), range(upperleftcell)._ offset(numbpoints-1, 0)) datarange.value = data sheetname = activesheet.name charts.add with activechart .hastitle = true .charttitle.characters.text = "my chart" .charttype = xllinemarkers .setsourcedata source:=datarange, plotby:=xlcolumns .location where:=xllocationasobject, name:=sheetname end with private sub drawlinegraph() dim i as long with draw1 'graph is a line graph .graphtype = dgtline 'set the origin and axes .originy = 150

.yaxisnegative = 100 .ytop = 50 .ygrad = 10 .xtop = 11 .xgrad = 1 'set some properties based on the check boxes if check11 then .linewidth = 2 else .linewidth = 1 end if if check12 then .pointsize = 4 .pointstyle = dgpsdot else .pointsize = 0 end if .showline = check13.value .showgrid = check14.value .showlegend = check15.value 'this option replaces the x-axis values with the values 'of the months array if check16 then .usexaxislabels = true for i = 0 to 11 .addxvalue i, months(i) next i else .usexaxislabels = false end if 'add the data points for i = 0 to 11 .addpoint i, line1values(i), vbred, "line 1" .addpoint i, line2values(i), vbblue, "line 2" next i 'draw the graph .drawgraph end with end sub random number generator sub normno() dim dim dim dim dim

iteration as variant mean as variant sd as variant alpha as variant i as long

iteration = range("c4").value mean = range("c5").value sd = range("c6").value

alpha = range("c3").value redim arr(iteration) as single for i = 1 to iteration arr(i) = gauss * sd + mean cells(6, 6) = i next i call sort(iteration, arr) cells(3, 6) = arr(alpha / 2 * iteration) cells(4, 6) = arr((1 - alpha / 2) * iteration) call hist(iteration, 20, arr(1), arr(iteration), arr) end sub '*********************************************************************** '* return random numbers from standard normal distribution * '*********************************************************************** function gauss() dim fac as double, r as double, v1 as double, v2 as double 10

v1 = 2 * rnd - 1 v2 = 2 * rnd - 1 r = v1 ^ 2 + v2 ^ 2 if (r >= 1) then goto 10 fac = sqr(-2 * log(r) / r) gauss = v2 * fac

end function '********************************************************************** '* sort the numbers generated * '********************************************************************** sub sort(n as variant, arr() as single) dim temp as double dim i as long dim j as long

10

for j = 2 to n temp = arr(j) for i = j - 1 to 1 step -1 if (arr(i) <= temp) then goto 10 arr(i + 1) = arr(i) next i i = 0 arr(i + 1) = temp next j

end sub '******************************************************************** '* construct historgram distribution

* '******************************************************************** sub hist(n as variant, m as long, start as single, right as single, arr() as single) dim i as long, j as long, find as long dim length as double redim breaks(m) as single redim freq(m) as single for i = 1 to m freq(i) = 0 next i length = (right - start) / m for i = 1 to m breaks(i) = start + length * i next i for i = 1 to n if (arr(i) <= breaks(1)) then freq(1) = freq(1) + 1 if (arr(i) >= breaks(m - 1)) then freq(m) = freq(m) + 1 for j = 2 to m - 1 if (arr(i) > breaks(j - 1) and arr(i) <= breaks(j)) then freq(j) = freq(j) + 1 next j next i for i = 1 to m cells(i + 2, 8) = breaks(i) cells(i + 2, 9) = freq(i) next i end sub

(1) dim oexcel as object dim obook as object dim osheet as object 'start a new workbook in excel set oexcel = createobject("excel.application") set obook = oexcel.workbooks.add 'add data to cells of the first worksheet in the new workbook set osheet = obook.worksheets(1) osheet.range("a1").value = "last name" osheet.range("b1").value = "first name"

osheet.range("a1:b1").font.bold = true osheet.range("a2").value = "doe" osheet.range("b2").value = "john" 'save the workbook and quit excel obook.saveas "c:\book1.xls" oexcel.quit (2) dim oexcel as object dim obook as object dim osheet as object 'start a new workbook in excel set oexcel = createobject("excel.application") set obook = oexcel.workbooks.add 'create an array with 3 columns and 100 rows dim dataarray(1 to 100, 1 to 3) as variant dim r as integer for r = 1 to 100 dataarray(r, 1) = "ord" & format(r, "0000") dataarray(r, 2) = rnd() * 1000 dataarray(r, 3) = dataarray(r, 2) * 0.7 next 'add headers to the worksheet on row 1 set osheet = obook.worksheets(1) osheet.range("a1:c1").value = array("order id", "amount", "tax") 'transfer the array to the worksheet starting at cell a2 osheet.range("a2").resize(100, 3).value = dataarray 'save the workbook and quit excel obook.saveas "c:\book1.xls" oexcel.quit (3) 'create a recordset from all the records in the orders table dim snwind as string dim conn as new adodb.connection dim rs as adodb.recordset snwind = _ "c:\program files\microsoft office\office\samples\northwind.mdb" conn.open "provider=microsoft.jet.oledb.4.0;data source=" & _ snwind & ";" conn.cursorlocation = aduseclient set rs = conn.execute("orders", , adcmdtable) 'create a new workbook in excel dim oexcel as object dim obook as object dim osheet as object set oexcel = createobject("excel.application") set obook = oexcel.workbooks.add set osheet = obook.worksheets(1) 'transfer the data to excel osheet.range("a1").copyfromrecordset rs

'save the workbook and quit excel obook.saveas "c:\book1.xls" oexcel.quit 'close the connection rs.close conn.close (4) 'create a new workbook in excel dim oexcel as object dim obook as object dim osheet as object set oexcel = createobject("excel.application") set obook = oexcel.workbooks.add set osheet = obook.worksheets(1) 'create the querytable dim snwind as string snwind = _ "c:\program files\microsoft office\office\samples\northwind.mdb" dim oqrytable as object set oqrytable = osheet.querytables.add( _ "oledb;provider=microsoft.jet.oledb.4.0;data source=" & _ snwind & ";", osheet.range("a1"), "select * from orders") oqrytable.refreshstyle = xlinsertentirerows oqrytable.refresh false 'save the workbook and quit excel obook.saveas "c:\book1.xls" oexcel.quit (5)

'copy a string to the clipboard dim sdata as string sdata = "firstname" & vbtab & "lastname" & vbtab & "birthdate" & vbcr _ & "bill" & vbtab & "brown" & vbtab & "2/5/85" & vbcr _ & "joe" & vbtab & "thomas" & vbtab & "1/1/91" clipboard.clear clipboard.settext sdata 'create a new workbook in excel dim oexcel as object dim obook as object set oexcel = createobject("excel.application") set obook = oexcel.workbooks.add 'paste the data obook.worksheets(1).range("a1").select obook.worksheets(1).paste 'save the workbook and quit excel obook.saveas "c:\book1.xls" oexcel.quit

(6) 'create a recordset from all the records in the orders table dim snwind as string dim conn as new adodb.connection dim rs as adodb.recordset dim sdata as string snwind = _ "c:\program files\microsoft office\office\samples\northwind.mdb" conn.open "provider=microsoft.jet.oledb.4.0;data source=" & _ snwind & ";" conn.cursorlocation = aduseclient set rs = conn.execute("orders", , adcmdtable) 'save the recordset as a tab-delimited file sdata = rs.getstring(adclipstring, , vbtab, vbcr, vbnullstring) open "c:\test.txt" for output as #1 print #1, sdata close #1 'close the connection rs.close conn.close 'open the new text file in excel shell "c:\program files\microsoft office\office\excel.exe " & _ chr(34) & "c:\test.txt" & chr(34), vbmaximizedfocus (7) 'create a new instance of excel dim oexcel as object dim obook as object dim osheet as object set oexcel = createobject("excel.application") 'open the text file set obook = oexcel.workbooks.open("c:\test.txt") 'save as excel workbook and quit excel obook.saveas "c:\book1.xls", xlworkbooknormal oexcel.quit (8) 'create a new connection object for book1.xls dim conn as new adodb.connection conn.open "provider=microsoft.jet.oledb.4.0;" & _ "data source=c:\book1.xls;extended properties=excel 8.0;" conn.execute "insert into mytable (firstname, lastname)" & _ " values ('bill', 'brown')" conn.execute "insert into mytable (firstname, lastname)" & _ " values ('joe', 'thomas')" conn.close (10) 'initiate a dde communication with excel text1.linkmode = 0 text1.linktopic = "excel|mybook.xls" text1.linkitem = "r1c1:r2c3" text1.linkmode = 1

'poke the text in text1 to the r1c1:r2c3 in mybook.xls text1.text = "one" & vbtab & "two" & vbtab & "three" & vbcr & _ "four" & vbtab & "five" & vbtab & "six" text1.linkpoke 'execute commands to select cell a1 (same as r1c1) and change the font 'format text1.linkexecute "[select(""r1c1"")]" text1.linkexecute "[font.properties(""times new roman"",""bold"",10)]" 'terminate the dde communication text1.linkmode = 0

class randomtest { public static void main (string args[]) { int[] ndigits = new int[10]; double x; int n; random myrandom = new random(); // initialize the array for (int i = 0; i < 10; i++) { ndigits[i] = 0; } // test the random number generator a whole lot for (long i=0; i < 100000; i++) { // generate a new random number between 0 and 9 x = myrandom.nextdouble() * 10.0; n = (int) x; //count the digits in the random number ndigits[n]++; }

}

// print the results for (int i = 0; i < 10; i++) { system.out.println(i+": " + ndigits[i]); }

} below is one possible output from this program. if you run it your results should be slightly different. after all this is supposed to be random. these results are pretty much what you would expect from a reasonably random generator. if you have a fast cpu and some time to spare, try bringing the number of tests up to a billion or so, and see if the counts for the different digits get any closer to each other.

dim dim dim dim dim

appexcel as new excel.application xldoc as excel.workbook xlsheet as excel.worksheet objchart as chartobject xlseries as seriescollection

dim strname() as string dim strxaxis as string dim strsql as string dim intheight as integer strsql = "select * from db_table " set xldoc = appexcel.workbooks.add set xlsheet = xldoc.worksheets(1) set m_rsdata = new adodb.recordset with m_rsdata .open strsql, oradb redim strname(.fields.count) as string 'this gives titles in a down fashion. 'to go across, one must go b1,c1,d1 for which i do not have a loop for iloop=1 to .fields.count-1 xlsheet.range("b" & .fields(iloop).name & ).cells=.fields(iloop).name next iloop intheight = 5 while not .eof xlsheet.range("b" & intheight).cells = format$(.fields("some_date"), "ddd mmm d") xlsheet.range("c" & intheight).cells = .fields(1) xlsheet.range("d" & intheight).cells = .fields(1) & " xlsheet.range("e" & intheight).cells = .fields(1) & " xlsheet.range("f" & intheight).cells = .fields(1) & " xlsheet.range("z" & intheight).cells = .fields(1) & " intheight = intheight + 1

& " " " " " "

.movenext wend .close end with ' add a chartobject to the worksheet: set objchart = xlsheet.chartobjects.add(100, 100, 500, 200) ' insert named ranges: strtmprange = "r5c3:r" & format$(intheight - 1) & "c3" xlsheet.parent.names.add "range1", "=sheet1!" & strtmprange strname(1) = "=sheet1!r3c3"

'etc

strtmprange = "r5c4:r" & format$(intheight - 1) & "c4" xlsheet.parent.names.add "range2", "=sheet1!" & strtmprange strname(2) = "=sheet1!r3c4"

'start the series collection set xlseries = objchart.chart.seriescollection for icount = 1 to 2 'the number of named ranges (which should be the number of fields) xlseries.add "range" & icount xlseries.item(icount).name = strname(icount) next icount set m_rsdata = nothing exit sub private sub msflexgrid1_dblclick() gridedit asc(" ") end sub private sub msflexgrid1_keypress(keyascii as integer) gridedit keyascii end sub sub gridedit(keyascii as integer) 'use correct font text1.fontname = msflexgrid1.fontname text1.fontsize = msflexgrid1.fontsize select case keyascii case 0 to asc(" ") text1 = msflexgrid1 text1.selstart = 1000 case else text1 = chr(keyascii) text1.selstart = 1 end select 'position the edit box text1.left = msflexgrid1.cellleft + msflexgrid1.left text1.top = msflexgrid1.celltop + msflexgrid1.top text1.width = msflexgrid1.cellwidth text1.height = msflexgrid1.cellheight text1.visible = true

text1.setfocus end sub private sub msflexgrid1_leavecell() if text1.visible then msflexgrid1 = text1 text1.visible = false end if end sub private sub msflexgrid1_gotfocus() if text1.visible then msflexgrid1 = text1 text1.visible = false end if end sub private sub text1_keydown(keycode as integer, shift as integer) select case keycode case vbkeyescape text1.visible = false msflexgrid1.setfocus case vbkeyreturn msflexgrid1.setfocus case vbkeydown msflexgrid1.setfocus doevents if msflexgrid1.row < msflexgrid1.rows - 1 then msflexgrid1.row = msflexgrid1.row + 1 end if case vbkeyup msflexgrid1.setfocus doevents if msflexgrid1.row > msflexgrid1.fixedrows then msflexgrid1.row = msflexgrid1.row - 1 end if end select end sub private sub text1_keypress(keyascii as integer) 'noise suppression if keyascii = vbkeyreturn then keyascii = 0 end sub dim intindex1 as integer dim lngmax as long dim lngmin as long dim dblvalues(0 to 19) as double dim lngwidth as long dim dblx as double for intindex1 = 1 to 19 load lblbar(intindex1) with lblbar(intindex1 - 1) lblbar(intindex1).top = .top + .height

end with next intindex1 for dblx = 1 to 20 intindex1 = dblx - 1 dblvalues(intindex1) = dblx ^ 2 if dblvalues(intindex1) < lngmin then lngmin = dblvalues(intindex1) next dblx lngwidth = lblbar(0).width for intindex1 = 0 to 19 ' solve w/w = (x-min)/(max-min) lblbar(intindex1).width = (dblvalues(intindex1) - lngmin) / (lngmax - lngmin) * lngwidth lblbar(intindex1).visible = true next intindex1 end sub

curve in picture option explicit private sub command1_click() form1.scalemode = 1 'twip dim xcent as integer, ycent as integer dim x as double, y as double xcent = 3000: ycent = 2400 circle (xcent, ycent), 200 form1.drawwidth = 2 for x = -1500 to 1500 step 10 y = int((x * x) * 0.001) - 800 pset (xcent + x, ycent - y), rgb(0, 200, 0) pset (xcent + x, ycent + y), rgb(0, 200, 0) next x currentx = currenty = print "y" currentx = currenty = print "x"

3000 100 5800 2400

end sub

5000 if msflexgrid1.mouserow = 0 or msflexgrid1.mousecol = 0 then text4.visible = false exit sub else text4.visible = false text4.top = msflexgrid1.top + msflexgrid1.celltop

text4.left = msflexgrid1.left + msflexgrid1.cellleft text4.width = msflexgrid1.cellwidth text4.height = msflexgrid1.cellheight text4.text = msflexgrid1.text text4.visible = true text4.setfocus end if msflexgrid1.text = text4.text

if msflexgrid2.mouserow = 0 or msflexgrid2.mousecol = 0 then text1.visible = false exit sub else text1.visible = false text1.top = msflexgrid2.top + msflexgrid2.celltop text1.left = msflexgrid2.left + msflexgrid2.cellleft text1.width = msflexgrid2.cellwidth text1.height = msflexgrid2.cellheight text1.text = msflexgrid2.text text1.visible = true text1.setfocus end if msflexgrid2.text = text1.text

private sub command2_click() form1.scalemode = 1 'twip dim xcent as integer, ycent as integer dim x as double, y as double, pi as double pi = 4 * atn(1) xcent = 3000: ycent = 2400 form1.drawwidth = 2 for x = -1500 to 1500 step 10 y = (sin(x * pi / 1500)) * 2000 'print y

pset (xcent + x, ycent - y), rgb(0, 200, 0) pset (xcent + x + (x / 2), ycent + y), rgb(200, 0, 0) next x line (3000, 100)-(3000, 5800) line (100, 2400)-(5800, 2400) currentx = 3100 currenty = 100 print "y" currentx = 5800 currenty = 2400 print "x" end sub 3003. dim t as single dim x0 as single dim y0 as single dim x1 as single dim y1 as single t = 0# x1 = x(t, pt0.x, pt1.x, pt2.x, pt3.x) y1 = y(t, pt0.y, pt1.y, pt2.y, pt3.y) t = t + dt do while t < 1# x0 = x1 y0 = y1 x1 = x(t, pt0.x, pt1.x, pt2.x, pt3.x) y1 = y(t, pt0.y, pt1.y, pt2.y, pt3.y) pic.line (x0, y0)-(x1, y1) t = t + dt loop ' connect to the final point. t = 1# x0 = x1 y0 = y1 x1 = x(t, pt0.x, pt1.x, pt2.x, pt3.x) y1 = y(t, pt0.y, pt1.y, pt2.y, pt3.y) pic.line (x0, y0)-(x1, y1) end sub

Related Documents

Txt
August 2019 22
Txt
May 2020 13
Txt
April 2020 48
Txt
November 2019 24
Txt
August 2019 21
Txt
November 2019 14