// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2011/11/04 double index, done; object marker_array[20]; double marker_count, loop; double result; double x[500], y[500]; double ang,vang,vdistance,rangle; object group_obj[50]; object current_object; point current_point; selection current_selection; double vp, ry, rl, vy, vye, ptl, ktk, sp, evy, sl, ktl, nv; double language; double sv; double siirtox, siirtoy; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","MB_macros", "This macro needs to be properly installed before running it."); } init_xarc_array(); vp=179; ry=117; vy=106; sp=55; sl=49; rl=43; nv=1.5; sv=1; double metric; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { vp=vp/2.54; ry=ry/2.54; rl=rl/2.54; vy=vy/2.54; sp=sp/2.54; sl=sl/2.54; nv=nv/2.54; sv=sv/2.54; } } else { metric=2*pop_up("Units","Inches","Centimeters"); if (metric<1) { vp=vp/2.54; ry=ry/2.54; rl=rl/2.54; vy=vy/2.54; sp=sp/2.54; sl=sl/2.54; nv=nv/2.54; sv=sv/2.54; } } if(metric==0) { sv=0.39; } double read; read = 0; if (is_function("measure_table")==1) { if (measure_table("default_men")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { start_picture_input("MEN'S VEST"); add_picture_input("Chest circumference", ry, "m_chest_circumference"); add_picture_input("Waist circumference", vy, "m_waist_circumference_shirt"); add_picture_input("Back length", sp, "m_back_length"); add_picture_input("Back width",sl, "m_back_width"); if (language == 0) { run_picture_input(); } } else { Dialog_box("MEN'S VEST - 1 of 1", "Chest circumference", ry, "Waist circumference", vy, "Back length", sp, "Back width",sl); } } if (is_function("start_picture_input")) { start_picture_input("CUSTOM MEASUREMENTS"); add_picture_input("Seam Allowance",sv, "meas_seamallow"); if (language == 0) { run_picture_input(); } } else { dialog_box( "CUSTOM MEASUREMENTS", "Seam Allowance",sv); } if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { vp=vp*2.54; ry=ry*2.54; rl=rl*2.54; vy=vy*2.54; sp=sp*2.54; sl=sl*2.54; nv=nv*2.54; } } else { if (metric<1) { vp=vp*2.54; ry=ry*2.54; rl=rl*2.54; vy=vy*2.54; sp=sp*2.54; sl=sl*2.54; nv=nv*2.54; } } if(metric==2) { sv=sv/2.54; } if (ry < 92) { ktk=22; } else { if (ry < 96) { ktk=22.8; } else { if (ry < 100) { ktk=23.6; } else { if (ry < 104) { ktk=24.4; } else { if (ry < 108) { ktk=25.3; } else { if (ry < 112) { ktk=26.4; } else { if (ry < 116) { ktk=26.8; } else { if (ry < 120) { ktk=27.2; } else { if (ry < 124) { ktk=27.6; } else { if (ry < 128) { ktk=28; } else { if (ry < 132) { ktk=28.4; } else { ktk=28.8; } } } } } } } } } } } ry=ry+4; vy=vy+4; sl=sl+2; ptl=ry/10; vye=vy/4-1; ktl=ry/8; rl=ry/2-ktl; x[0]=0; y[0]=0; coord(0,1,0,0); coord(1,3,0,-ktk); coord(1,2,1,-ktk/2); coord(1,4,0,-sp); coord(1,5,-ptl,0); coord(5,6,0,2); coord(4,7,-2.5,0); coord(3,103,-50,0); line_intersect(3,103,2,7,9); coord(7,10,0,-8.5); coord(9,11,-sl/2,0); coord(1,12,-sl/2,0); coord(12,13,0,-2); coord(11,14,-ktl,0); coord(1,15,-sl/2-ktl,0); coord(4,16,-sl/2-ktl,0); coord(14,17,-rl/2,0); coord(16,18,-vye,0); center(14,17,19); center(16,18,20); coord(18,21,0,-15); coord(21,22,2.5,0); coord(19,23,0,ktk); coord(15,24,0,-3.5); cont(6,13,25,-2.5); cont(24,23,26,-dist(6,25)-0.5); coord(14,27,3.5,0); coord(16,28,2.5,0); coord(28,29,1,-7); coord(27,30,0,-2); coord(26,126,-4,-dist(14,24)/2); coord(25,125,2,-dist(11,13)/2); coord(18,31,vy/2+6,0); coord(28,32,dist(31,7),0); coord(32,33,-.5,-7); center(10,33,34); coord(34,134,.75,0); y[134]=y[31]; coord(34,234,-.75,0); y[234]=y[31]; coord(34,111,0,0); y[111]=y[3]-2; coord(20,35,1.5,0); coord(19,211,1.5,-2); coord(211,122,0,-100); line_intersect(211,122,22,29,36); coord(36,136,.5,0); coord(36,236,-.5,0); x[135]=x[211]+0.75; y[135]=y[35]; x[235]=x[211]-0.75; y[235]=y[35]; coord(17,117,-nv,0); coord(18,118,-nv,0); coord(118,121,0,-5); cont(26,23,37,1); center(117,23,123); x[123]=x[19]-dist(19,117)/2; coord(6,38,0,.5); coord(1,101,0,1); cont(13,38,138,1); current_object=newobject("poly"); addpoint((x[101]+5+siirtox)/2.54, (y[101]+siirtoy)/2.54, "LINE"); addpoint((x[2]+5+siirtox)/2.54, (y[2]+siirtoy)/2.54, "LINE"); addpoint((x[9]+5+siirtox)/2.54, (y[9]+siirtoy)/2.54, "LINE"); addpoint((x[7]+5+siirtox)/2.54, (y[7]+siirtoy)/2.54, "LINE"); addpoint((x[10]+5+siirtox)/2.54, (y[10]+siirtoy)/2.54, "LINE"); addpoint((x[34]+5+siirtox)/2.54, (y[34]+siirtoy)/2.54, "LINE"); addpoint((x[134]+5+siirtox)/2.54, (y[134]+siirtoy)/2.54, "LINE"); addpoint((x[111]+5+siirtox)/2.54, (y[111]+siirtoy)/2.54, "LINE"); addpoint((x[234]+5+siirtox)/2.54, (y[234]+siirtoy)/2.54, "LINE"); addpoint((x[34]+5+siirtox)/2.54, (y[34]+siirtoy)/2.54, "LINE"); addpoint((x[33]+5+siirtox)/2.54, (y[33]+siirtoy)/2.54, "LINE"); addpoint((x[32]+5+siirtox)/2.54, (y[32]+siirtoy)/2.54, "LINE"); addpoint((x[30]+5+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_start"); addpoint((x[125]+5+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_corner"); addpoint((x[125]+5+siirtox)/2.54, (y[125]+siirtoy)/2.54, "LINE"); addpoint((x[25]+5+siirtox)/2.54, (y[25]+siirtoy)/2.54, "LINE"); addpoint((x[138]+5+siirtox)/2.54, (y[138]+siirtoy)/2.54, "xarc_start"); addpoint((x[5]+5+siirtox+1)/2.54, (y[5]+siirtoy)/2.54, "xarc_corner"); group_obj[1]=current_object; current_object=newobject("poly"); addpoint((x[5]+5+siirtox)/2.54, (y[1]-10)/2.54, "LINE"); addpoint((x[5]+5+siirtox)/2.54, (y[4]+siirtoy)/2.54, "LINE"); group_obj[2]=current_object; if(sv>0) { offset_mark(1); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); } else { mark(1); current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); } current_object=newobject("poly"); addpoint((x[26]+siirtox)/2.54, (y[26]+siirtoy)/2.54, "LINE"); addpoint((x[126]+siirtox)/2.54, (y[126]+siirtoy)/2.54, "xarc_start"); addpoint((x[126]-1+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_corner"); addpoint((x[30]+siirtox)/2.54, (y[30]+siirtoy)/2.54, "LINE"); addpoint((x[28]+siirtox)/2.54, (y[28]+siirtoy)/2.54, "LINE"); addpoint((x[29]+siirtox)/2.54, (y[29]+siirtoy)/2.54, "LINE"); addpoint((x[136]+siirtox)/2.54, (y[136]+siirtoy)/2.54, "LINE"); addpoint((x[135]+siirtox)/2.54, (y[135]+siirtoy)/2.54, "LINE"); addpoint((x[211]+siirtox)/2.54, (y[211]+siirtoy)/2.54, "LINE"); addpoint((x[235]+siirtox)/2.54, (y[235]+siirtoy)/2.54, "LINE"); addpoint((x[236]+siirtox)/2.54, (y[236]+siirtoy)/2.54, "LINE"); addpoint((x[22]+siirtox)/2.54, (y[22]+siirtoy)/2.54, "LINE"); addpoint((x[121]+siirtox)/2.54, (y[121]+siirtoy)/2.54, "LINE"); addpoint((x[117]+siirtox)/2.54, (y[117]+siirtoy)/2.54, "xarc_start"); addpoint((x[123]+siirtox)/2.54, (y[123]+siirtoy)/2.54, "xarc_corner"); addpoint((x[37]+siirtox)/2.54, (y[37]+siirtoy)/2.54, "LINE"); group_obj[3]=current_object; coord(17,301,0,0); coord(118,306,nv,-5); cont(306,301,302,-dist(301,306)/5); cont(306,301,303,-2*dist(301,306)/5); cont(306,301,304,-3*dist(301,306)/5); cont(306,301,305,-4*dist(301,306)/5); current_object=newobject("poly"); current_point= addpoint((x[301]+siirtox)/2.54, (y[301]+siirtoy)/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point= addpoint((x[302]+siirtox)/2.54, (y[302]+siirtoy)/2.54, "open"); notch_type(current_point,"BTN",0); current_point= addpoint((x[303]+siirtox)/2.54, (y[303]+siirtoy)/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point= addpoint((x[304]+siirtox)/2.54, (y[304]+siirtoy)/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point= addpoint((x[305]+siirtox)/2.54, (y[305]+siirtoy)/2.54, "LINE"); notch_type(current_point,"BTN",0); current_point= addpoint((x[306]+siirtox)/2.54, (y[306]+siirtoy)/2.54, "LINE"); notch_type(current_point,"BTN",0); group_obj[4]=current_object; if (language == 0) { current_object=newobject("text","Center Front",4.626059,0.2,0.2,"SIMP.CHR"); } addpoint((x[301]+.5+siirtox)/2.54, (y[301]-1+siirtoy)/2.54, "LINE"); group_obj[11]=current_object; if(sv>0) { offset_mark(3); select(current_selection,group_obj[4]); select(current_selection,group_obj[11]); group(current_selection); deselect(current_selection); } else { mark(3); current_selection=newselection("OBJECT"); select(current_selection,group_obj[3]); select(current_selection,group_obj[4]); select(current_selection,group_obj[11]); group(current_selection); deselect(current_selection); } siirtox=-vy/3; current_object=newobject("poly"); cont(26,37,137,-5); addpoint((x[117]+siirtox)/2.54, (y[117]+siirtoy)/2.54, "xarc_start"); addpoint((x[123]+siirtox)/2.54, (y[123]+siirtoy)/2.54, "xarc_corner"); addpoint((x[37]+siirtox)/2.54, (y[37]+siirtoy)/2.54, "line"); addpoint((x[137]+siirtox)/2.54, (y[137]+siirtoy)/2.54, "xarc_start"); addpoint((x[17]+5+siirtox)/2.54, (y[17]+siirtoy)/2.54, "xarc_corner"); addpoint((x[121]+7+siirtox)/2.54, (y[121]+siirtoy)/2.54, "line"); cont(236,22,122,-5); addpoint((x[122]+siirtox)/2.54, (y[122]+siirtoy)/2.54, "line"); addpoint((x[22]+siirtox)/2.54, (y[22]+siirtoy)/2.54, "line"); addpoint((x[121]+siirtox)/2.54, (y[121]+siirtoy)/2.54, "line"); group_obj[5]=current_object; if(sv>0) { offset_mark(5); group(current_selection); deselect(current_selection); } else { mark(5); current_selection=newselection("OBJECT"); select(current_selection,group_obj[5]); group(current_selection); deselect(current_selection); } current_object=newobject("poly"); cont(23,24,124,-5); cont(126,26,226,-5); cont(28,30,230,-5); addpoint((x[26]+siirtox)/2.54, (y[26]+siirtoy)/2.54, "LINE"); addpoint((x[126]+siirtox)/2.54, (y[126]+siirtoy)/2.54, "xarc_start"); addpoint((x[126]-1+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_corner"); addpoint((x[30]+siirtox)/2.54, (y[30]+siirtoy)/2.54, "LINE"); addpoint((x[230]+siirtox)/2.54, (y[230]+siirtoy)/2.54, "xarc_start"); addpoint((x[126]-5-1+siirtox)/2.54, (y[230]+siirtoy)/2.54, "xarc_corner"); addpoint((x[126]-5+siirtox)/2.54, (y[126]+siirtoy)/2.54, "LINE"); addpoint((x[124]+siirtox)/2.54, (y[124]+siirtoy)/2.54, "LINE"); group_obj[8]=current_object; if(sv>0) { offset_mark(8); group(current_selection); deselect(current_selection); } else { mark(8); current_selection=newselection("OBJECT"); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } siirtox=vy/3-5; current_object=newobject("poly"); addpoint((x[101]+5+siirtox)/2.54, (y[101]-5+siirtoy)/2.54, "xarc_start"); addpoint((x[5]+5+siirtox)/2.54, (y[5]-1-5+siirtoy)/2.54, "xarc_corner"); cont(13,138,238,-5); addpoint((x[238]+5+siirtox)/2.54, (y[238]+siirtoy)/2.54, "line"); addpoint((x[138]+5+siirtox)/2.54, (y[138]+siirtoy)/2.54, "xarc_start"); addpoint((x[5]+5+siirtox+1)/2.54, (y[5]+siirtoy)/2.54, "xarc_corner"); addpoint((x[101]+5+siirtox)/2.54, (y[101]+siirtoy)/2.54, "open"); group_obj[6]=current_object; current_object=newobj_dot((x[101]+5+siirtox)/2.54, (y[101]-5+siirtoy)/2.54); addpoint((x[101]+5+siirtox)/2.54, (y[101]+siirtoy)/2.54, "open"); group_obj[9]=current_object; if (language == 0) { current_object=newobject("text","CB",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[101]+5-2+siirtox)/2.54, (y[101]-2+siirtoy)/2.54, "line"); group_obj[10]=current_object; if(sv>0) { offset_mark(6); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); } else { mark(6); current_selection=newselection("OBJECT"); select(current_selection,group_obj[6]); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); group(current_selection); deselect(current_selection); } current_object=newobject("poly"); cont(138,25,113,-5); addpoint((x[113]+5+siirtox)/2.54, (y[113]+siirtoy)/2.54, "line"); addpoint((x[125]+5+siirtox+5)/2.54, (y[125]+siirtoy)/2.54, "xarc_start"); addpoint((x[125]+5+siirtox+5)/2.54, (y[30]-5+siirtoy)/2.54, "xarc_corner"); cont(32,30,130,-5); addpoint((x[130]+5+siirtox)/2.54, (y[130]+siirtoy)/2.54, "line"); addpoint((x[30]+5+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_start"); addpoint((x[125]+5+siirtox)/2.54, (y[30]+siirtoy)/2.54, "xarc_corner"); addpoint((x[125]+5+siirtox)/2.54, (y[125]+siirtoy)/2.54, "LINE"); addpoint((x[25]+5+siirtox)/2.54, (y[25]+siirtoy)/2.54, "LINE"); group_obj[7]=current_object; if(sv>0) { offset_mark(7); group(current_selection); deselect(current_selection); } else { mark(7); current_selection=newselection("OBJECT"); select(current_selection,group_obj[7]); group(current_selection); deselect(current_selection); } current_selection=newselection("OBJECT"); for (loop = 0; loop < 20; loop = loop + 1) { if (marker_array[loop] != 0) { select(current_selection, marker_array[loop]); } } check_overlap(current_selection); if (is_function("origin_arrange")==1) { origin_arrange(current_selection); } deselect(current_selection); if (is_function("set_marker")==1) { for (loop = 0; loop < 20; loop = loop + 1) { if (marker_array[loop] != 0) { set_marker(marker_array[loop], 0); } } } run_command("zoomall"); } newobj_dot(double x, double y) { object temp; line("CENTER_LINE"); temp = newobject("poly"); addpoint(x, y, "line"); line("SOLID_LINE"); return temp; } coord(double orig, double dest, double xxx, double yyy) { x[dest]=x[orig]+xxx; y[dest]=y[orig]+yyy; } center(double one, double two, double result) { x[result]=(x[one]+x[two])/2; y[result]=(y[one]+y[two])/2; } dist(double p1, double p2) { return distance(x[p1],y[p1],x[p2],y[p2]); } line_intersect(double start1, double end1, double start2, double end2, double dest) { double tempx; double tempy; intersect(x[start1],y[start1],x[end1],y[end1],x[start2],y[start2],x[end2],y[end2],0); x[dest]=getresultx(); y[dest]=getresulty(); } cont(double cstart, double cend, double cdest, double cvdistanceance) { double ang; ang=angle(x[cstart], y[cstart], x[cend], y[cend]); polar(x[cend], y[cend], ang, cvdistanceance); x[cdest]=getresultx(); y[cdest]=getresulty(); } right_ang(double start, double end, double to_point, double dest) { double m,b; if (x[start]==x[end]) { x[dest]=x[end]; y[dest]=y[to_point]; } else { if (y[start]==y[end]) { x[dest]=x[to_point]; y[dest]=y[end]; } else { m=(y[start]-y[end])/(x[start]-x[end]); m=-1/m; b=y[to_point]-m*x[to_point]; intersect(x[start],y[start],x[end],y[end],x[to_point],y[to_point],0,b,0); x[dest]=getresultx(); y[dest]=getresulty(); } } } mark(double pass_index) { group_obj[pass_index]=marker_piece(group_obj[pass_index],1); marker_array[marker_count] = group_obj[pass_index]; marker_count = marker_count + 1; } offset_mark(double pass_index) { point pnt, test; double save_x, save_y; current_selection=newselection("OBJECT"); select(current_selection,group_obj[pass_index]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); current_object=last_obj(); marker_array[marker_count] = marker_piece(current_object,1); current_selection=newselection("OBJECT"); select(current_selection, marker_array[marker_count]); select(current_selection, group_obj[pass_index]); marker_count = marker_count + 1; } Forward() { index = index + 1; if (index == 0) { done = 1; } } Backward() { index = index - 1; } shift(double orig, double xxx, double yyy) { x[orig]=x[orig]+xxx; y[orig]=y[orig]+yyy; } rect (double x1, double y1, double x2, double y2) { newobject("poly"); addpoint( x1/2.54,y1/2.54,"LINE"); addpoint( x2/2.54,y1/2.54,"LINE"); addpoint( x2/2.54,y2/2.54,"LINE"); addpoint( x1/2.54,y2/2.54,"LINE"); } dot (double x, double y) { newobject("poly"); addpoint( x/2.54,y/2.54,"LINE"); } line (double x3, double y3, double x4, double y4) { newobject("poly"); addpoint( x3/2.54,y3/2.54,"LINE"); addpoint( x4/2.54,y4/2.54,"LINE"); } rotate(double rpoint,double rcenter, double rangle) { double vdistance, vang; vdistance=dist(rpoint, rcenter); vang=angle(x[rcenter],y[rcenter],x[rpoint],y[rpoint]); polar(x[rcenter],y[rcenter],vang+rangle,vdistance); x[rpoint]=getresultx(); y[rpoint]=getresulty(); } linecirc(double PA,double PB,double PC,double dradius,double which, double PD) { double mslope, dist0, dist1, dist2, xtemp; double tx, ty; xtemp = (x[PB]-x[PC])*(x[PB]-x[PC]); if (xtemp > 0) { xtemp = (y[PB]-y[PC])*(y[PB]-y[PC]); if ( xtemp > 0) { mslope = (y[PC] - y[PB])/(x[PC] - x[PB]); tx = x[PA] + 1; ty = y[PA] - 1/mslope; intersect(x[PA], y[PA], tx, ty, x[PB], y[PB], x[PC], y[PC], 0); tx = getresultx(); ty = getresulty(); dist1 = distance(x[PA], y[PA], tx, ty); dist2 = interceptline(0, dist1, dradius); dist0 = sqrt(1+mslope*mslope); xtemp = dist2/dist0; if (which) { x[PD] = tx+xtemp; y[PD] = ty+ xtemp*mslope; } else { x[PD] = tx-xtemp; y[PD] = ty- xtemp*mslope; } } else { x[PD] = x[PB]; if (which) { y[PD] = y[PA] + interceptline(x[PA], x[PB], dradius); } else { y[PD] = y[PA] - interceptline(x[PA], x[PB], dradius); } } } else { y[PD] = y[PB]; if (which) { x[PD] = x[PA] + interceptline(y[PA], y[PB], dradius); } else { x[PD] = x[PA] - interceptline(y[PA], y[PB], dradius); } } } double xarc_x_array[13], xarc_y_array[13]; double return_x, return_y; arclength(double start, double corner, double end) { double count, last_x, last_y; double a_dist; last_x = x[start]; last_y = y[start]; a_dist=0; for (count=1; count < 12; count = count + 1) { from_tspace(start, corner, end, count); a_dist = a_dist + distance(return_x, return_y, last_x, last_y); last_x=return_x; last_y=return_y; } return a_dist; } double A1, A2, B1, B2; double sx, sy, cx, cy, ex, ey; double tspace_0[2], tspace_1[2]; double ft_center[2]; from_tspace(double start, double corner, double end, double pos) { if (pos<1) { return_x=x[start]; return_y=y[start]; } else { if (pos<2) { sx = x[start]; sy = y[start]; cx = x[corner]; cy = y[corner]; ex = x[end]; ey = y[end]; A1=cx - sx; A2=cy - sy; B1=cx - ex; B2=cy - ey; A1=-A1; B1=-B1; A2=-A2; B2=-B2; tspace_0[0]=A1; tspace_0[1]=B1; tspace_1[0]=A2; tspace_1[1]=B2; ft_center[0]= cx + (tspace_0[0] + tspace_0[1]); ft_center[1]= cy + (tspace_1[0] + tspace_1[1]); return_x = tspace_0[0]*(xarc_x_array[pos])+tspace_0[1] * (xarc_y_array[pos])+ ft_center[0]; return_y = tspace_1[0]*(xarc_x_array[pos])+tspace_1[1] * (xarc_y_array[pos])+ ft_center[1]; } else { if (pos>10) { return_x=x[end]; return_y=y[end]; } else { return_x = tspace_0[0]*(xarc_x_array[pos])+tspace_0[1] * (xarc_y_array[pos])+ ft_center[0]; return_y = tspace_1[0]*(xarc_x_array[pos])+tspace_1[1] * (xarc_y_array[pos])+ ft_center[1]; } } } } init_xarc_array() { double ang_start, ang_end, step, theta, count; double XARC_PIECES; XARC_PIECES = 12; ang_start = -3.14159/2; ang_end= -3.14159; count=0; step= (ang_end - ang_start)/(XARC_PIECES-1); for (theta=ang_start; count < XARC_PIECES; theta = theta + step) { xarc_x_array[count] = cos(theta); xarc_y_array[count] = sin(theta); count=count+1; } } max(double aa, double bb) { if (aa > bb) { return aa; } else { return bb; } } min(double aa, double bb) { if (aa < bb) { return aa; } else { return bb; } }