1. Trang chủ
  2. » Giáo án - Bài giảng

lập trình mô phỏng

6 227 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 6
Dung lượng 51 KB

Nội dung

VE HINH VUONG function main create_line 6,7,10,7 appear Point,6,7,A appear Point,10,7,B note_edge -1,value,A,B appear TSquare move TSquare, 6,7,90 appear Compa create_arc 6,7,4,90 appear Point,6,3,C,above disappear TSquare create_line 6,7,6,3 note_angle 0,value,10,7,6,7,6,3 note_edge -1,value,A,C delay 15 appear TSquare move TSquare, 6,3,0 appear Compa create_arc 6,3,4,0 disappear TSquare appear Point,10,3,D,above create_line 6,3,10,3 note_edge -1,value,C,D delay 15 create_line 10,3,10,7 note_edge -1,value,D,B end VE HINH VUONG VOI CANH TUY Y function main appear Text, 8.25, 0.5, "Hãy vẽ đoạn thẳng", input_line &ax, &ay, &bx, &by disappear Text appear Point, ax, ay, "A", below appear Point, bx, by, "B", below create_line ax, ay, bx, by,3 note_edge -1,value,ax,ay,bx,by AB = sqrt((ax-bx)^2 + (ay-by)^2) get_angle &angle, ax, ay, bx, by delay 15 set_paper Nhap appear TSquare move TSquare,ax,ay,angle+90 appear Compa move Compa,ax,ay,angle call Compa.OpenCompa, AB rotate_compa Compa,AB,angle+120 disappear Compa set_paper Chinh,3 a=ax-AB*sin(angle) b=ay-AB*cos(angle) appear Point, a,b,C,above create_line a,b,ax,ay note_angle 0,value,bx,by,ax,ay,a,b note_edge -1,value,ax,ay,a,b erase Nhap delay 15 set_paper Nhap move TSquare,bx,by,angle+90 appear Compa move Compa,bx,by,angle-180 call Compa.OpenCompa,AB rotate_compa Compa,AB, angle +120 set_paper Chinh,3 m=bx-AB*sin(angle) n=by-AB*cos(angle) appear Point, m,n,D,above disappear TSquare disappear Compa erase Nhap create_line m,n,bx,by note_edge -1,value,B,D delay 15 create_line a,b,m,n note_edge -1,value,C,D end VE TAM GIAC function main set_paper Chinh,3 create_line 6,7,10,7 appear Point,6,7,A appear Point, 10,7,B note_edge -1,value,A,B set_paper Nhap create_arc 6,7,3,30,120 create_arc 10,7,5,90,150 appear Point,6,4,C,above set_paper Chinh,3 create_line 6,7,6,4 note_edge -1,value,A,C create_line 10,7,6,4 note_edge -1,value,B,C delay 15 erase Nhap end VE TAM GIAC VOI CANH TUY Y function main input_data "Nhập cạnh", "AB", lenAB, "AC", lenAC, "BC", lenBC angleB = arccos((lenAB^2 + lenBC^2 - lenAC^2)/(2*lenAB*lenBC)) get_point &ax, &ay, 4, 7, angleB, lenAB DrawTriangle 4, 7, 4+lenBC, 7, ax, ay, B, C, A end function DrawTriangle x1, y1, x2, y2, x3, y3, a1, a2, a3 create_line2 x1, y1, x2, y2 appear Point, x1, y1, a1, below appear Point, x2, y2, a2, below note_edge -1, value, x2, y2, x1, y1 delay 12 set_paper Draft create_arc x1, y1, lenAB, 0, 360 create_arc x2, y2, lenAC, 90, 180 appear Point, x3, y3, a3, above delay 12 set_paper Paper create_line x1, y1, x3, y3 note_edge -1, value, x1, y1, x3, y3 create_line x3, y3, x2, y2 note_edge -1, value, x3, y3, x2, y2 delay 12 erase Draft end VIET CAC KY HIEU CANH, GOC function ShowTriangle x1, y1, x2, y2, x3, y3 set_paper Chinh,3 appear Point,x1,y1,A appear Point,x2,y2,B appear Point,x3,y3,C,above create_line x1,y1,x2,y2 create_line x2,y2,x3,y3 create_line x3,y3,x1,y1 delay 12 set_paper Paper, 2, 0x0FFFFF note_edge 2, "value", x2, y2, x1, y1 delay 12 note_edge 1, "value", x3, y3, x2, y2 delay 12 note_edge 0, "value", x1, y1, x3, y3 delay 12 note_angle 0, "value", x2, y2, x1, y1, x3, y3 delay 12 note_angle 2, "value", x3, y3, x2, y2, x1, y1 delay 12 note_angle 1, "value", x1, y1, x3, y3, x2, y2 delay 33 end function main ShowTriangle 4, 7, 12, 7, 6, end CAT GHEP HINH THANG THANH HINH CHU NHAT function main set_paper Chinh,1 create_line 7,3,10,3 appear Point,7,3,A,above appear Point,10,3,B,above delay 15 create_line 5,7,13,7 appear Point,13,7,C,right appear Point,5,7,D,left delay 15 create_line 5,7,7,3 delay 15 create_line 10,3,13,7 polygon Tamgiac, 8, 6, 0x7F7FFF, -1, -3,2,-3,5, 1, -3, set_paper Nhap appear Point,6,5,M,left cut_polygon 6,2,6,8 erase Nhap move Tamgiac2, 4, 4, -180 set_paper Nhap appear Point,11.5,5,N,right cut_polygon 11.5,2,11.5,8 erase Nhap move Tamgiac12, 15, 4, 180 appear Point,6,3,A',above appear Point,11.5,3,B',above appear Point,6,7,C',below appear Point,11.5,7,D',below end CAT GHEP HINH THANG THANH HINH TAM GIAC function main set_paper Chinh,1 create_line 7,3,10,3 appear Point,7,3,A,above appear Point,10,3,B,above delay 15 create_line 5,7,13,7 appear Point,13,7,C,right appear Point,5,7,D delay 15 create_line 5,7,7,3 delay 15 create_line 10,3,13,7 polygon Thang, 8, 6, 0x7F7FFF, -1, -3,2,-3,5, 1, -3, set_paper Nhap appear Point,6,5,M,leftabove cut_polygon 10,3,6,5 erase Nhap move Thang1, 4, 4, 180 appear Point,2,7,A',left end CAT GHEP TAM GIAC THANH HINH CHU NHAT function main set_paper Chinh,1 create_line 5,7,13,7 appear Point,13,7,B,right appear Point,5,7,A,left delay 15 appear Point,7,3,C,above delay 15 create_line 5,7,7,3 delay 15 create_line 7,3,13,7 polygon Tamgiac,7,3, 0x7F7FFF, 0,0,6,4,2,4 set_paper Nhap appear Point,6,5,M,left cut_polygon 6,2,6,8 erase Nhap move Tamgiac2, 4, 4, -180 set_paper Nhap appear Point,11.5,5,N,right cut_polygon 11.5,2,11.5,8 erase Nhap move Tamgiac12, 15, 4, 180 appear Point,6,3,A',above appear Point,11.5,3,B',above appear Point,6,7,C',below appear Point,11.5,7,D',below end

Ngày đăng: 31/10/2015, 03:03

TỪ KHÓA LIÊN QUAN

w