//Lblouse.mac //Copyright (C) 1996 Leena Lähteenmäki, Kerava, Finland double x[600], y[600]; //viimeinen 532 double ang,ang2,vang,vdistance,rangle; double current_point; object group_obj[200]; //viimeinen 80 object current_object; point current_point; selection current_selection; //VARIABLES double model,ky,ry,vy,yly,aly,rkkv,rk,vk,sp,sl,op; double ylk,alk,kay,ray,hp; double eml, tml, sml, smlyly,smlaly; double ktk,ktl,ptl,ptp,pts,rl,pk; double okt,oke; double ktpe,ktpt,ktp; double pit; double ease, f_ry[3],f_ky[3],f_vy[3],f_yly[3],f_aly[3],f_rkkv[3],f_sl[3]; double f_op[3],f_vk[3],f_rk[3],f_rl[3],f_sp[3],f_ktk[3]; double f_kay[3],f_ray[3],f_hp[3]; double current_object; double kpe,kpt,kp; double collar; double napit,int; double sleeve, sleeve_length; double shoulder_padding; double nv; double sv; double metric; double siirtox, siirtoy; double language; double mansetti; main() { language=0; //englanti=English // language=1; //suomi=Finnish //CHOICE OF EASE if(language==0)//English { // ease=pop_up("BUST EASE","Normal (+12cm)", "Minimum (+10cm)","Maximum (+14cm)"); ease=pop_up("BUST EASE","Normal (+4.75in/+12cm)", "Minimum (+4in/+10cm)","Maximum (+5.5in/+14cm)"); } else { ease=pop_up("Rinnanympärysväljyys","Normaali (+12cm)", "Minimi (+10cm)","Maksimi (+14cm)"); } //model if(language==0)//English { // model=pop_up("Model","Dart to shoulder","Dart to side"); model=pop_up("BLOUSE MODEL","Princess to shoulder","Bust dart"); } else { model=pop_up("MALLI","Muotolaskos olalle","Muotolaskos sivuun"); } //CHOICE of SLEEVE if(language==0)//English { // sleeve=pop_up("CHOICE OF SLEEVE", // "Fitting sleeve", // "Shirt sleeve", // "Dropped sleeve"); sleeve=pop_up("SLEEVE STYLE", "Fitted sleeve", "Shirt sleeve", "Dropped sleeve"); } else { sleeve=pop_up("HIHAVAIHTOEHDOT", "Istuva hiha", "Paitahiha", "Pudotettu olkapää"); } //CHOICE OF SLEEVE LENGTH if(language==0)//English { sleeve_length=pop_up("SLEEVE LENGTH", "Long", "Short"); } else { sleeve_length=pop_up("HIHAN PITUUS", "Pitkä", "Lyhyt"); } //CHOICE of shoulder pads if(language==0)//English { // shoulder_padding=pop_up("EASE FOR SHOULDER PADS","Shoulder pads","No shoulder pads"); shoulder_padding=pop_up("SHOULDER PAD EASE","Shoulder pads","No shoulder pads"); } else { shoulder_padding=pop_up("OLKATOPPAUKSET","Olkatoppaukset","Ei olkatoppauksia"); } if(metric==2) { sv=sv/2.54; } mansetti=ray+4; oke=3.6;okt=2.6;rl=8.1;ktk=22.4; //Default measurements (Scandinavian 42) ky=39.25; //neck circ. ry=96; //bust circ vy=78; //waist circ. yly=95; //abdomen circ. aly=102; //hip circ. rkkv=21; //bust span rk=36.8; //bust height vk=55.4; //waist height //53.4 =oikea pituus sp=41.3; //back length sl=37.6; //back width op=13.5; //shoulder length ylk=9; //abdomen height alk=19; //hip height kay=30; //biceps circ. ray=18.5; //wrist circ. hp=60.4; //sleeve length sv=0; pit=35; nv=2; //EASE / normal +12 f_ry[0]=76+12; f_ky[0]=ky+1.5; f_vy[0]=vy+10; f_yly[0]=yly+2+8; f_aly[0]=aly+2+8; f_rkkv[0]=rkkv+1.2; f_sl[0]=sl+2.8; f_op[0]=op; f_vk[0]=vk; f_rk[0]=rk; f_rl[0]=rl+0.2; f_sp[0]=sp; f_ktk[0]=ktk+2.5; f_kay[0]=kay+9; f_ray[0]=ray+9; f_hp[0]=hp+0.5; //EASE / minimum +10 f_ry[1]=76+10; f_ky[1]=ky+0.75; f_vy[1]=vy+8; f_yly[1]=yly+2+6; f_aly[1]=aly+2+6; f_rkkv[1]=rkkv+1; f_sl[1]=sl+2.2; f_op[1]=op; f_vk[1]=vk; f_rk[1]=rk; f_rl[1]=rl+0.1; f_sp[1]=sp; f_ktk[1]=ktk+2; f_kay[1]=kay+8; f_ray[1]=ray+8; f_hp[1]=hp; //EASE / maximum +14 f_ry[2]=76+14; f_ky[2]=ky+1.5; f_vy[2]=vy+12; f_yly[2]=yly+2+10; f_aly[2]=aly+2+10; f_rkkv[2]=rkkv+1.4; f_sl[2]=sl+3.4; f_op[2]=op; f_vk[2]=vk; f_rk[2]=rk; f_rl[2]=rl+0.3; f_sp[2]=sp; f_ktk[2]=ktk+3; f_kay[2]=kay+10; f_ray[2]=ray+10; f_hp[2]=hp+0.75; ry=f_ry[ease]; ky=f_ky[ease]; vy=f_vy[ease]; yly=f_yly[ease]; aly=f_aly[ease]; rkkv=f_rkkv[ease]; sl=f_sl[ease]; op=f_op[ease]; vk=f_vk[ease]; rk=f_rk[ease]; rl=f_rl[ease]; sp=f_sp[ease]; ktk=f_ktk[ease]; kay=f_kay[ease]; ray=f_ray[ease]; //kaavat---------------------------------------------------- pts=ky/5+0.5; ptl=ky/5-1; ktl=76/8-1.5; eml=3; tml=3; sml=(76/2-vy/2)-6; smlyly=(76/2-yly/2)-3; smlaly=(76/2-aly/2); if(aly0) { if(language==0)//English { //KE-teksti current_object=newobject("text","Front piece, Cut 2, CF",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Keskietukappale, leikkaa 2 kpl, KE",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[3]+siirtox)/2.54, (y[3])/2.54, "line"); group_obj[71]=current_object; //Hem seam allowance if(language==0)//English { current_object=newobject("text","Check hem seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Tarkista helmavara",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[3]-5+siirtox)/2.54, (y[6]+1.2-pit+alk)/2.54, "line"); group_obj[76]=current_object; } else { //KE-teksti if(language==0)//English { current_object=newobject("text","Center Front.",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Keskietu",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[3]+siirtox)/2.54, (y[3])/2.54, "line"); group_obj[71]=current_object; } } draw_back_facing() { siirtoy=8; //takasisävara cont(127,22,127,-5); current_object=newobject ("poly"); addpoint ((x[21]+siirtox)/2.54, (y[21]+siirtoy)/2.54, "xarc_start"); addpoint ((x[122]+siirtox)/2.54, (y[122]+siirtoy)/2.54, "xarc_corner"); addpoint ((x[22]+siirtox)/2.54, (y[22]+siirtoy)/2.54, "LINE"); if(model==0) { addpoint ((x[127]+siirtox)/2.54, (y[127]+siirtoy)/2.54, "xarc_start"); } else { addpoint ((x[127]+siirtox)/2.54, (y[127]-0.6+siirtoy)/2.54, "xarc_start"); } addpoint ((x[122]+siirtox)/2.54, ((y[122]-5)+siirtoy)/2.54, "xarc_corner"); addpoint ((x[21]+siirtox)/2.54, ((y[21]-4)+siirtoy)/2.54, "LINE"); group_obj[31]=current_object; //teksti if(language==0)//English { current_object=newobject("text","Back facing, Cut 1 on fold, CB-->",0.0,0.1,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Takasisavara, KT-->",0.0,0.1,0.2,"SIMP.CHR"); } addpoint ((x[22]+siirtox)/2.54, (y[21]-2+siirtoy)/2.54, "line"); group_obj[32]=current_object; //Ryhmitys ja saumanvarat if(sv>0) { //teksti if(language==0)//English { current_object=newobject("text","When cut on fold remove CB seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Leikattaessa taitteelta poista KT-saumanvara",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[22]+siirtox)/2.54, (y[21]-2+siirtoy-1)/2.54, "line"); group_obj[78]=current_object; //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[31]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[32]); select(current_selection,group_obj[78]); group(current_selection); deselect(current_selection); } else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[31]); select(current_selection,group_obj[32]); group(current_selection); deselect(current_selection); } siirtoy=0; } //debug(1); Draw_collar() { siirtox=4; siirtoy=2; current_object=newobject ("poly"); addpoint ((x[400])/2.54, (y[400]+5)/2.54, "line"); addpoint ((x[401])/2.54, y[401]/2.54, "xarc_start"); addpoint ((x[402])/2.54, y[402]/2.54, "xarc_corner"); addpoint ((x[403])/2.54, y[403]/2.54, "line"); addpoint ((x[404])/2.54, y[404]/2.54, "line"); addpoint ((x[410])/2.54, y[410]/2.54, "LINE"); addpoint ((x[409])/2.54, y[409]/2.54, "line"); addpoint ((x[408])/2.54, y[408]/2.54, "xarc_start"); addpoint ((x[407])/2.54, y[407]/2.54, "xarc_corner"); addpoint ((x[406])/2.54, y[406]/2.54, "line"); addpoint ((x[405])/2.54, y[405]/2.54, "LINE"); group_obj[1]=current_object; //teksti if(language==0)//English { current_object=newobject("text","Collar, Cut 1 on fold, CB--->",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Kaulus, Leikkaa 1 kpl taitteelta, KT--->",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[400]-20)/2.54, (y[400]+7)/2.54, "line"); group_obj[2]=current_object; //Ryhmitys ja saumanvarat if(sv>0) { //teksti if(language==0)//English { current_object=newobject("text","When cut on fold, remove CB seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Leikattaessa taitteelta poista KT-saumanvara",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[400]-20)/2.54, (y[400]+7-1)/2.54, "line"); group_obj[77]=current_object; //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[2]); select(current_selection,group_obj[77]); group(current_selection); deselect(current_selection); } else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[1]); select(current_selection,group_obj[2]); group(current_selection); deselect(current_selection); } siirtox=0; siirtoy=0; } //NAPIT //debug(2); Draw_buttons() { //napit int=(dist(102,5)-2)/4; current_object=newobject("poly"); current_point=addpoint ((x[3])/2.54, (y[102]-2)/2.54, "line");notch_type(current_point,"BTN",0); current_point=addpoint ((x[3])/2.54, (y[102]-2-int)/2.54, "line");notch_type(current_point,"BTN",0); current_point=addpoint ((x[3])/2.54, (y[102]-2-2*int)/2.54, "line");notch_type(current_point,"BTN",0); current_point=addpoint ((x[3])/2.54, (y[102]-2-3*int)/2.54, "line");notch_type(current_point,"BTN",0); current_point=addpoint ((x[3])/2.54, (y[102]-2-4*int)/2.54, "open");notch_type(current_point,"BTN",0); group_obj[3]=current_object; } //debug(5); Draw_princess_CF() { //debug(53); //KAPPALE current_object=newobject ("poly"); addpoint ((x[131])/2.54, (y[131])/2.54, "line"); addpoint ((x[31])/2.54, (y[31])/2.54, "xarc_start"); addpoint ((x[31])/2.54, (y[102])/2.54, "xarc_corner"); addpoint ((x[3])/2.54, (y[102])/2.54, "line"); addpoint ((x[3]-nv)/2.54, (y[102])/2.54, "line"); addpoint ((x[3]-2*nv)/2.54, (y[102])/2.54, "xarc_start"); addpoint ((x[31]-2*ptl-3*nv)/2.54, (y[102])/2.54, "xarc_corner"); addpoint ((x[31]-3*nv-2*ptl)/2.54, (y[31])/2.54, "line"); addpoint ((x[213]-2*ptl-2*nv-8)/2.54, (y[131])/2.54, "xarc_start"); CURRENT_POINT=addpoint ((x[3]-nv-nv-7)/2.54, (y[3])/2.54, "xarc_corner"); CURRENT_POINT=addpoint ((x[4]-nv-nv-7)/2.54, (y[4])/2.54, "line"); CURRENT_POINT=addpoint ((x[5]-nv-nv-7)/2.54, (y[5])/2.54, "line"); CURRENT_POINT=addpoint ((x[6]-nv-nv-7)/2.54, (y[6])/2.54, "line"); CURRENT_POINT=addpoint ((x[6]-nv-nv-7)/2.54, (y[6]-pit+alk)/2.54, "line"); addpoint ((x[6]-nv)/2.54, (y[6]-pit+alk)/2.54, "line"); addpoint ((x[38])/2.54, (y[38]-pit+alk)/2.54, "line"); CURRENT_POINT=addpoint ((x[38])/2.54, (y[38])/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[39])/2.54, (y[39])/2.54, "line"); current_point=addpoint ((x[40])/2.54, (y[40])/2.54, "line");notch_type(current_point,"NOTCH",1); current_point=addpoint ((x[30])/2.54, (y[30])/2.54, "line");notch_type(current_point,"NOTCH",0); group_obj[14]=current_object; //Taiteviiva current_object=newobject ("poly"); addpoint ((x[6]-nv)/2.54, (y[102])/2.54, "line"); addpoint ((x[6]-nv)/2.54, (y[6]-pit+alk)/2.54, "open"); group_obj[58]=current_object; //debug(56); //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[14]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[3]); //Taiteviiva select(current_selection,group_obj[58]); //cf text select(current_selection,group_obj[71]); //hem text select(current_selection,group_obj[76]); group(current_selection); deselect(current_selection); } //debug(57); else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[14]); select(current_selection,group_obj[3]); //Taiteviiva select(current_selection,group_obj[58]); //cf text select(current_selection,group_obj[71]); group(current_selection); deselect(current_selection); } } //debug(6); Draw_princess_front_side() { //grain current_object=newobject ("poly"); addpoint ((x[10]-5)/2.54, (y[10]-5)/2.54, "line"); addpoint ((x[10]-5)/2.54, (y[51])/2.54, "open"); group_obj[63]=current_object; //debug(61); //teksti if(language==0)//English { current_object=newobject("text","Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Lankasuora",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[10]-5+0.2+siirtox)/2.54, (y[4])/2.54, "line"); group_obj[17]=current_object; //debug(62); //KAPPALE current_object=newobject ("poly"); addpoint ((x[11])/2.54, (y[11])/2.54, "xarc_start"); addpoint ((x[10])/2.54, (y[10])/2.54, "xarc_corner"); addpoint ((x[34])/2.54, (y[34])/2.54, "xarc_start"); addpoint ((x[36])/2.54, (y[36])/2.54, "xarc_corner"); addpoint ((x[33])/2.54, (y[33])/2.54, "line"); addpoint ((x[132])/2.54, (y[132])/2.54, "xarc_start"); cont(132,30,130,-2); x[130]=x[30]; addpoint ((x[130])/2.54, (y[130])/2.54, "xarc_corner"); cont(41,30,230,-2); current_point=addpoint ((x[30])/2.54, (y[30])/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[230])/2.54, (y[230])/2.54, "line"); current_point=addpoint ((x[41])/2.54, (y[41])/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[39])/2.54, (y[39])/2.54, "line"); current_point=addpoint ((x[38])/2.54, (y[38])/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[38])/2.54, (y[38]-pit+alk)/2.54, "line"); addpoint ((x[52])/2.54, (y[52]-pit+alk)/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[52])/2.54, (y[52])/2.54, "xarc_start");notch_type(current_point,"NOTCH",1); current_point=addpoint ((x[51])/2.54, (y[51])/2.54, "xarc_corner");notch_type(current_point,"NOTCH",1); addpoint ((x[151])/2.54, (y[151])/2.54, "xarc_start"); CURRENT_POINT=addpoint ((x[50])/2.54, (y[50])/2.54, "xarc_corner");notch_type(current_point,"NOTCH",1); addpoint ((x[111])/2.54, (y[111])/2.54, "line"); group_obj[18]=current_object; //debug(63); //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[18]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[63]); select(current_selection,group_obj[17]); group(current_selection); deselect(current_selection); } //debug(64); else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[18]); select(current_selection,group_obj[63]); select(current_selection,group_obj[17]); group(current_selection); deselect(current_selection); } } //debug(8); Draw_straight_front() { ang=angle(x[30],y[30],x[131],y[131])-angle(x[30],y[30],x[132],y[132]); rotate(132,30,ang); rotate(33,30,ang); rotate(36,30,ang); rotate(34,30,ang); rotate(10,30,ang); rotate(11,30,ang); rotate(310,30,ang); rotate(507,30,ang); //debug(81); //vyötärömuotolaskos current_object=newobject("poly"); addpoint ((x[30])/2.54, (y[30]-2)/2.54, "line"); addpoint ((x[41])/2.54, (y[41])/2.54, "line"); addpoint ((x[39])/2.54, (y[39])/2.54, "line"); addpoint ((x[40])/2.54, (y[40])/2.54, "line"); group_obj[64]=current_object; //debug(85); current_object=newobject("poly"); addpoint ((x[31])/2.54, (y[31])/2.54, "xarc_start"); addpoint ((x[31])/2.54, (y[102])/2.54, "xarc_corner"); addpoint ((x[3])/2.54, (y[102])/2.54, "line"); addpoint ((x[3]-nv)/2.54, (y[102])/2.54, "line"); addpoint ((x[3]-2*nv)/2.54, (y[102])/2.54, "xarc_start"); addpoint ((x[31]-2*ptl-3*nv)/2.54, (y[102])/2.54, "xarc_corner"); addpoint ((x[31]-3*nv-2*ptl)/2.54, (y[31])/2.54, "line"); addpoint ((x[213]-2*ptl-2*nv-8)/2.54, (y[131])/2.54, "xarc_start"); CURRENT_POINT= addpoint ((x[3]-nv-nv-7)/2.54, (y[3])/2.54, "xarc_corner"); CURRENT_POINT= addpoint ((x[4]-nv-nv-7)/2.54, (y[4])/2.54, "line"); CURRENT_POINT=addpoint ((x[5]-nv-nv-7)/2.54, (y[5])/2.54, "line"); CURRENT_POINT=addpoint ((x[6]-nv-nv-7)/2.54, (y[6])/2.54, "line"); addpoint ((x[6]-nv-nv-7)/2.54, (y[6]-pit+alk)/2.54, "line"); addpoint ((x[6]-nv)/2.54, (y[6]-pit+alk)/2.54, "xarc_start"); addpoint ((x[38])/2.54, (y[38]-pit+alk)/2.54, "xarc_corner"); addpoint ((x[52])/2.54, (y[52]-pit+alk)/2.54, "line"); addpoint ((x[52])/2.54, (y[52])/2.54, "xarc_start"); addpoint ((x[51])/2.54, (y[51])/2.54, "xarc_corner"); addpoint ((x[151])/2.54, (y[151])/2.54, "xarc_start"); addpoint ((x[50])/2.54, (y[50])/2.54, "xarc_corner"); addpoint ((x[111])/2.54, (y[111])/2.54, "line"); addpoint ((x[311])/2.54, (y[311])/2.54, "line"); addpoint ((x[30]+2)/2.54, (y[30])/2.54, "line"); addpoint ((x[310])/2.54, (y[310])/2.54, "line"); addpoint ((x[11])/2.54, (y[11])/2.54, "xarc_start"); addpoint ((x[10])/2.54, (y[10])/2.54, "xarc_corner"); addpoint ((x[34])/2.54, (y[34])/2.54, "xarc_start"); addpoint ((x[36])/2.54, (y[36])/2.54, "xarc_corner"); addpoint ((x[33])/2.54, (y[33])/2.54, "line"); group_obj[27]=current_object; //Taiteviiva current_object=newobject ("poly"); addpoint ((x[6]-nv)/2.54, (y[102])/2.54, "line"); addpoint ((x[6]-nv)/2.54, (y[6]-pit+alk)/2.54, "open"); group_obj[58]=current_object; //debug(86); //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[27]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[3]); //vyötärömuotolaskos select(current_selection,group_obj[64]); //taiteviiva select(current_selection,group_obj[58]); //cf text select(current_selection,group_obj[71]); //hem text select(current_selection,group_obj[76]); group(current_selection); deselect(current_selection); } //debug(87); else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[27]); select(current_selection,group_obj[3]); //vyötärömuotolaskos select(current_selection,group_obj[64]); //taiteviiva select(current_selection,group_obj[58]); //cf text select(current_selection,group_obj[71]); group(current_selection); deselect(current_selection); } //palautus rotate(132,30,-ang); rotate(33,30,-ang); rotate(36,30,-ang); rotate(34,30,-ang); rotate(10,30,-ang); rotate(11,30,-ang); rotate(310,30,-ang); rotate(507,30,-ang); } //debug(9); Draw_princess_back_side() { //grainline back side current_object=newobject ("poly"); addpoint ((x[9]+2+4+siirtox)/2.54, (y[10]-5)/2.54, "line"); addpoint ((x[9]+2+4+siirtox)/2.54, (y[51])/2.54, "open"); group_obj[28]=current_object; //debug(91); //teksti if(language==0)//English { current_object=newobject("text","Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Lankasuora",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[9]+2+4+0.2+siirtox)/2.54, (y[4])/2.54, "line"); group_obj[29]=current_object; //debug(92); //kappale current_object=newobject ("poly"); CURRENT_POINT=addpoint ((x[148]+4)/2.54, (y[148])/2.54, "xarc_start"); CURRENT_POINT=addpoint ((x[49]+4)/2.54, (y[49])/2.54, "xarc_corner"); CURRENT_POINT=addpoint ((x[149]+4)/2.54, (y[149])/2.54, "line"); addpoint ((x[54]+4)/2.54, (y[54])/2.54, "xarc_start"); addpoint ((x[53]+4)/2.54, (y[53])/2.54, "xarc_corner"); // addpoint ((x[11]+4)/2.54, (y[11])/2.54, "xarc_start"); // addpoint ((x[9]+4)/2.54, (y[9])/2.54, "xarc_corner"); addpoint ((x[35]+4)/2.54, (y[35])/2.54, "xarc_start"); addpoint ((x[37]+4)/2.54, (y[37])/2.54, "xarc_corner"); addpoint ((x[26]+4)/2.54, (y[26])/2.54, "line"); addpoint ((x[129]+4)/2.54, (y[129])/2.54, "xarc_start"); addpoint ((x[28]+4)/2.54, (y[28])/2.54, "xarc_corner"); current_point=addpoint ((x[45]+4)/2.54, (y[45])/2.54, "line");notch_type(current_point,"NOTCH",1); current_point= addpoint ((x[44]+4)/2.54, (y[44])/2.54, "line");notch_type(current_point,"NOTCH",0); addpoint ((x[43]+4)/2.54, (y[43])/2.54, "line"); addpoint ((x[42]+4)/2.54, (y[42])/2.54, "line"); addpoint ((x[42]+4)/2.54, (y[42]-pit+alk)/2.54, "line"); addpoint ((x[47]+4)/2.54, (y[47]-pit+alk)/2.54, "line"); addpoint ((x[47]+4)/2.54, (y[47])/2.54, "xarc_start");notch_type(current_point,"NOTCH",1); current_point=addpoint ((x[48]+4)/2.54, (y[48])/2.54, "xarc_corner"); group_obj[30]=current_object; //debug(93); //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[30]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[28]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } //debug(94); else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[30]); select(current_selection,group_obj[28]); select(current_selection,group_obj[29]); group(current_selection); deselect(current_selection); } } //debug(10); Draw_princess_CB() { //grainline, princess, back current_object=newobject ("poly"); addpoint ((x[46]+2+4+siirtox)/2.54, (y[10]-5)/2.54, "line"); addpoint ((x[46]+2+4+siirtox)/2.54, (y[51])/2.54, "open"); group_obj[33]=current_object; //teksti if(language==0)//English { current_object=newobject("text","Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Lankasuora",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[46]+2+4+0.2+siirtox)/2.54, (y[4])/2.54, "line"); group_obj[34]=current_object; //teksti if(language==0)//English { current_object=newobject("text","Back piece, Cut 1 on fold, CB",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Takakappale, leikkaa 1 kpl taitteelta, KT",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[21]-2+4+siirtox)/2.54, (y[12])/2.54, "line"); group_obj[80]=current_object; //kappale current_object=newobject ("poly"); current_point=addpoint ((x[46]+4)/2.54, (y[46])/2.54, "line");notch_type(current_point,"NOTCH",0); addpoint ((x[45]+4)/2.54, (y[45])/2.54, "xarc_start"); addpoint ((x[28]+4)/2.54, (y[28])/2.54, "xarc_corner"); addpoint ((x[127]+4)/2.54, (y[127])/2.54, "line"); addpoint ((x[22]+4)/2.54, (y[22])/2.54, "xarc_start"); addpoint ((x[122]+4)/2.54, (y[122])/2.54, "xarc_corner"); addpoint ((x[21]+4)/2.54, (y[21])/2.54, "line"); addpoint ((x[12]+4)/2.54, (y[12]+dist(12,21)/2)/2.54, "line"); current_point=addpoint ((x[13]+4)/2.54, (y[13])/2.54, "line");notch_type(current_point,"NOTCH",0); addpoint ((x[14]+4)/2.54, (y[14])/2.54, "line"); addpoint ((x[15]+4)/2.54, (y[15]-pit+alk)/2.54, "line"); addpoint ((x[42]+4)/2.54, (y[42]-pit+alk)/2.54, "line"); current_point=addpoint ((x[42]+4)/2.54, (y[42])/2.54, "line");notch_type(current_point,"NOTCH",0); addpoint ((x[43]+4)/2.54, (y[43])/2.54, "line"); group_obj[35]=current_object; //Ryhmitys ja saumanvarat if(sv>0) { //teksti if(language==0)//English { current_object=newobject("text","Check hem seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Tarkista helmavara",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[35]+4-5+siirtox)/2.54, (y[38]+1.2-pit+alk)/2.54, "line"); group_obj[79]=current_object; //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[35]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[33]); select(current_selection,group_obj[34]); //cb text select(current_selection,group_obj[80]); //hem seam allowance select(current_selection,group_obj[79]); group(current_selection); deselect(current_selection); } else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[35]); select(current_selection,group_obj[33]); select(current_selection,group_obj[34]); //cb text select(current_selection,group_obj[80]); group(current_selection); deselect(current_selection); } } //debug(12); Draw_straight_back() { //vyötärömuotolaskos current_object=newobject("poly"); addpoint ((x[44]+4)/2.54, (y[44])/2.54, "line"); addpoint ((x[45]+4)/2.54, (y[45])/2.54, "line"); addpoint ((x[46]+4)/2.54, (y[46])/2.54, "line"); addpoint ((x[42]+4)/2.54, (y[42])/2.54, "line"); group_obj[40]=current_object; //debug(125); //grainline, straight, back current_object=newobject ("poly"); addpoint ((x[46]+2+4+siirtox)/2.54, (y[10]-5)/2.54, "line"); addpoint ((x[46]+2+4+siirtox)/2.54, (y[51])/2.54, "open"); group_obj[41]=current_object; //debug(126); //teksti if(language==0)//English { current_object=newobject("text","Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Lankasuora",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[46]+2+4+0.2+siirtox)/2.54, (y[4])/2.54, "line"); group_obj[42]=current_object; //teksti if(language==0)//English { current_object=newobject("text","Back piece, Cut 1 on fold, CB",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Takakappale, leikkaa 1 kpl taitteelta, KT",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[21]-2+4+siirtox)/2.54, (y[12])/2.54, "line"); group_obj[80]=current_object; //debug(127); //kappale current_object=newobject ("poly"); addpoint ((x[14]+4)/2.54, (y[14])/2.54, "line"); addpoint ((x[13]+4)/2.54, (y[13])/2.54, "line"); addpoint ((x[12]+4)/2.54, (y[21]-dist(21,12)/2)/2.54, "line"); addpoint ((x[21]+4)/2.54, (y[21])/2.54, "xarc_start"); addpoint ((x[122]+4)/2.54, (y[122])/2.54, "xarc_corner"); addpoint ((x[22]+4)/2.54, (y[22])/2.54, "line"); addpoint ((x[26]+4)/2.54, (y[26])/2.54, "xarc_start"); addpoint ((x[37]+4)/2.54, (y[37])/2.54, "xarc_corner"); addpoint ((x[35]+4)/2.54, (y[35])/2.54, "xarc_start"); addpoint ((x[53]+4)/2.54, (y[53])/2.54, "xarc_corner"); addpoint ((x[54]+4)/2.54, (y[54])/2.54, "line"); addpoint ((x[149]+4)/2.54, (y[149])/2.54, "line"); addpoint ((x[148]+4)/2.54, (y[148])/2.54, "xarc_start"); addpoint ((x[48]+4)/2.54, (y[48])/2.54, "xarc_corner"); addpoint ((x[47]+4)/2.54, (y[47])/2.54, "line");notch_type(current_point,"NOTCH",1); addpoint ((x[47]+4)/2.54, (y[47]-pit+alk)/2.54, "line"); addpoint ((x[42]+4)/2.54, (y[42]-pit+alk)/2.54, "line"); addpoint ((x[15]+4)/2.54, (y[15]-pit+alk)/2.54, "line"); addpoint ((x[15]+4)/2.54, (y[15])/2.54, "line"); group_obj[45]=current_object; //debug(128); //Ryhmitys ja saumanvarat if(sv>0) { //teksti if(language==0)//English { current_object=newobject("text","Check hem seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Tarkista helmavara",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[35]+4-5+siirtox)/2.54, (y[38]+1.2-pit+alk)/2.54, "line"); group_obj[79]=current_object; //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[45]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[40]); select(current_selection,group_obj[41]); select(current_selection,group_obj[42]); select(current_selection,group_obj[80]); //hem seam allowance select(current_selection,group_obj[79]); group(current_selection); deselect(current_selection); } //debug(129); else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[45]); select(current_selection,group_obj[40]); select(current_selection,group_obj[41]); select(current_selection,group_obj[42]); select(current_selection,group_obj[80]); group(current_selection); deselect(current_selection); } } //debug(13); Draw_sleeves() { if((sleeve==0)||(sleeve==1)) { ktpe=arclength(33,36,34)+arclength(34,10,11); ktpt=arclength(26,37,35)+arclength(35,9,11); } else//dropped sleeve { ktpe=arclength(33,34,11); ktpt=arclength(26,35,11); } ktp=ktpe+ktpt; if(sleeve==2) { pk=ktp/3-6; } else { pk=ktp/3; } //1 coord(0,1,kay/2+6,0); //2 coord(1,2,0,-pk/3); //3 coord(2,3,0,-pk/3); //4 coord(3,4,0,-pk/3); //5 if(sleeve==2) { coord(1,5,0,-hp+6); } else { coord(1,5,0,-hp); } //6 center(5,1,6); y[6]=y[6]-4; //7 coord(5,7,0,-3); //8 //lisays=syöttövaraa if((sleeve==0)||(sleeve==1)) { //coord(4,8,-sqrt(ktpe*ktpe-pk*pk)+1,0); coord(4,8,-kay/2+1,0); } else { //coord(4,8,-sqrt(ktpe*ktpe-pk*pk)-3,0); coord(4,8,-kay/2-3,0); } //9 if((sleeve==0)||(sleeve==1)) { //coord(4,9,sqrt(ktpt*ktpt-pk*pk)+1,0); coord(4,9,kay/2+1,0); } else { //coord(4,9,sqrt(ktpt*ktpt-pk*pk)+1.5,0); coord(4,9,kay/2+3,0); } coord(5,10,-(kay/2)+2,0); coord(5,11,+(kay/2)-2,0); center(8,10,12); y[12]=y[6]; center(9,11,13); y[13]=y[6]; //14 cont(12,10,14,1.5); //15 center(5,10,15); //16 center(5,7,16); //17 coord(7,17,+(kay/4-2),0); //18 cont(13,11,18,1.5); coord(8,19,ktl/2,0); coord(1,20,-5,0); cont(19,20,21,-dist(19,20)/3); cont(20,19,22,-dist(19,20)/3); coord(9,23,-ktl/4,0); coord(1,24,5,0); cont(23,24,25,-dist(23,24)/3); cont(24,23,26,-dist(23,24)/3); //24 coord(1,24,5,0); //25 cont(23,24,25,-dist(23,24)/3); //26 cont(24,23,26,-dist(23,24)/3); //27 coord(5,27,-2,0); //28 coord(6,28,0,0); rotate (28,27,-angle(x[6],y[6],x[27]+90*3.14/180,y[27])); cont(28,27,28,-(ray/2-1)); //29 cont(28,27,29,+(ray/2+1)); //30 coord(12,30,2.5,0); //31 coord(13,31,.5,0); cont(30,28,28,.5); cont(13,29,29,.5); //32 coord(6,32,dist(12,13)/4+1,0); if(sleeve==2) { y[30]=y[30]+3; y[31]=y[31]+3; y[32]=y[32]+3; } //33 coord(31,33,0,-2); cont(33,32,33,-dist(31,32)); //debug(61); //HIHAKAPPALE current_object=newobject ("poly"); current_point=addpoint ((x[1])/2.54, (y[1])/2.54, "xarc_start");notch_type(current_point,"NOTCH",1); addpoint ((x[20])/2.54, (y[20])/2.54, "xarc_corner"); addpoint ((x[21])/2.54, (y[21])/2.54, "line"); addpoint ((x[22])/2.54, (y[22])/2.54, "xarc_start"); addpoint ((x[19])/2.54, (y[19])/2.54, "xarc_corner"); if(sleeve_length==0)//pitkä { if(sleeve==0)//fitting sleeve { addpoint ((x[8])/2.54, (y[8])/2.54, "xarc_start"); addpoint ((x[30])/2.54, (y[30])/2.54, "xarc_corner"); addpoint ((x[28])/2.54, (y[28])/2.54, "line"); addpoint ((x[27])/2.54, (y[27])/2.54, "line"); addpoint ((x[29])/2.54, (y[29])/2.54, "line"); addpoint ((x[33])/2.54, (y[33])/2.54, "line"); addpoint ((x[32])/2.54, (y[32])/2.54, "line"); addpoint ((x[31])/2.54, (y[31])/2.54, "line"); } if(sleeve>0)//shirt sleeve + dropped { addpoint ((x[8])/2.54, (y[8])/2.54, "line"); addpoint ((x[14])/2.54, (y[14])/2.54, "xarc_start"); addpoint ((x[15])/2.54, (y[15])/2.54, "xarc_corner"); addpoint ((x[16])/2.54, (y[16])/2.54, "xarc_start"); addpoint ((x[17])/2.54, (y[17])/2.54, "xarc_corner"); addpoint ((x[18])/2.54, (y[18])/2.54, "line"); } } else //lyhyt { addpoint ((x[8])/2.54, (y[8])/2.54, "line"); addpoint ((x[8]+2)/2.54, (y[8]-10)/2.54, "line"); addpoint ((x[9]-1)/2.54, (y[9]-10)/2.54, "line"); } addpoint ((x[9])/2.54, (y[9])/2.54, "xarc_start"); addpoint ((x[23])/2.54, (y[23])/2.54, "xarc_corner"); addpoint ((x[26])/2.54, (y[26])/2.54, "line"); addpoint ((x[25])/2.54, (y[25])/2.54, "xarc_start"); addpoint ((x[24])/2.54, (y[24])/2.54, "xarc_corner"); group_obj[46]=current_object; //debug(62); //hihansuun halkio if((sleeve>0)&&(sleeve_length==0))//shirt sleeve { current_object=newobject ("poly"); addpoint ((x[17])/2.54, (y[17])/2.54, "line"); addpoint ((x[17])/2.54, (y[17]+10)/2.54, "open"); group_obj[52]=current_object; } //debug(63); //keskiviiva current_object=newobject ("poly"); if(sleeve_length==1)//lyhyt { if((sleeve==0)||(sleeve==1)) { addpoint ((x[1])/2.54, (y[1])/2.54, "line"); } else { addpoint ((x[1])/2.54, (y[1]-3)/2.54, "line"); } addpoint ((x[1])/2.54, (y[8]-10)/2.54, "open"); } else { if((sleeve==0)||(sleeve==1)) { addpoint ((x[1])/2.54, (y[1])/2.54, "line"); } else { addpoint ((x[1])/2.54, (y[1]-3)/2.54, "line"); } addpoint ((x[1])/2.54, (y[6])/2.54, "open"); } group_obj[47]=current_object; //debug(64); //teksti if(language==0)//English { current_object=newobject("text","Sleeve Front",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Etuhiha",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[19]+3)/2.54, (y[19]+2)/2.54, "line"); group_obj[48]=current_object; //debug(65); //teksti if(language==0)//English { current_object=newobject("text","Sleeve Back",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Takahiha",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[26]-3)/2.54, (y[19]+2)/2.54, "line"); group_obj[49]=current_object; //debug(66); //teksti if((sleeve==0)||(sleeve==1)) { if(language==0)//English { current_object=newobject("text","Sleeve. Cut 2. Shoulder.",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Hiha, leikkaa 2 kpl, olka",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[1]+0.2)/2.54, (y[1]-1)/2.54, "line"); group_obj[50]=current_object; } else//dropped sleeve { if(language==0)//English { current_object=newobject("text","Sleeve. Cut 2. Shoulder.",-1.570796,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Hiha, leikkaa 2, olka",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint ((x[1]+0.2)/2.54, (y[1]-7)/2.54, "line"); group_obj[51]=current_object; } //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[46]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[47]); select(current_selection,group_obj[48]); select(current_selection,group_obj[49]); if((sleeve==0)||(sleeve==1)) { select(current_selection,group_obj[50]); } else//dropped sleeve { select(current_selection,group_obj[51]); } if((sleeve==1)&&(sleeve_length==0))//hihansuun halkio { select(current_selection,group_obj[52]); } group(current_selection); deselect(current_selection); } else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[46]); select(current_selection,group_obj[47]); select(current_selection,group_obj[48]); select(current_selection,group_obj[49]); if((sleeve==0)||(sleeve==1)) { select(current_selection,group_obj[50]); } else//dropped sleeve { select(current_selection,group_obj[51]); } if((sleeve==1)&&(sleeve_length==0))//hihansuun halkio { select(current_selection,group_obj[52]); } group(current_selection); deselect(current_selection); } //mansetti if((sleeve>0)&&(sleeve_length==0))//shirt sleeve { siirtox=0; siirtoy=-7; //mansetti current_object=newobject ("poly"); addpoint ((x[7]-2+siirtox)/2.54, (y[7]+siirtoy)/2.54, "line"); addpoint ((x[7]+2+mansetti+siirtox)/2.54, (y[7]+siirtoy)/2.54, "line"); addpoint ((x[7]+2+mansetti+siirtox)/2.54, (y[7]-6+siirtoy)/2.54, "line"); addpoint ((x[7]-2+siirtox)/2.54, (y[7]-6+siirtoy)/2.54, "line"); group_obj[53]=current_object; //mansetti, nappivara current_object=newobject ("poly"); addpoint ((x[7]+siirtox)/2.54, (y[7]+siirtoy)/2.54, "line"); addpoint ((x[7]+siirtox)/2.54, (y[7]-6+siirtoy)/2.54, "open"); group_obj[54]=current_object; //mansetti, nappivara current_object=newobject ("poly"); addpoint ((x[7]+mansetti+siirtox)/2.54, (y[7]+siirtoy)/2.54, "line"); addpoint ((x[7]+mansetti+siirtox)/2.54, (y[7]-6+siirtoy)/2.54, "open"); group_obj[55]=current_object; //mansetti, taiteviiva current_object=newobject ("poly"); current_point=addpoint ((x[7]+siirtox)/2.54, (y[7]-3+siirtoy)/2.54, "line");notch_type(current_point,"BTN",0); addpoint ((x[7]+mansetti+siirtox)/2.54, (y[7]-3+siirtoy)/2.54, "open"); group_obj[56]=current_object; //mansetti, teksti if(language==0)//English { current_object=newobject("text","Sleeve cuff, Cut 2.",0.0,0.2,0.2,"SIMP.CHR"); } else { current_object=newobject("text","Mansetti, leikkaa 2 kpl",0.0,0.2,0.2,"SIMP.CHR"); } addpoint ((x[7]+2+siirtox)/2.54, (y[7]-1+siirtoy)/2.54, "line"); group_obj[57]=current_object; //Ryhmitys ja saumanvarat if(sv>0) { //saumanvara current_selection=newselection("OBJECT"); select(current_selection,group_obj[53]); sel_push(current_selection); var_push(sv); run_command("OFFSET"); deselect(current_selection); //ryhmitys current_selection=newselection("OBJECT"); get_result_selection(current_selection); select(current_selection,group_obj[54]); select(current_selection,group_obj[55]); select(current_selection,group_obj[56]); select(current_selection,group_obj[57]); group(current_selection); deselect(current_selection); } else { //ryhmitys ilman saumanvaroja current_selection=newselection("OBJECT"); select(current_selection,group_obj[53]); select(current_selection,group_obj[54]); select(current_selection,group_obj[55]); select(current_selection,group_obj[56]); select(current_selection,group_obj[57]); group(current_selection); deselect(current_selection); } } } newobject("poly"); { line("CENTER_LINE"); current_object=newobject ("POLY"); line("SOLID_LINE"); } 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(); } shift(double orig, double xxx, double yyy) { x[orig]=x[orig]+xxx; y[orig]=y[orig]+yyy; } 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) { // PA = center of circle, PB and PC determine line, dradius is radius of // circle, "which" is 0 or 1 (which of 2 possible intersections) // PD is output point i.e. 4 means put results in Point 4. double mslope, dist0, dist1, dist2, xtemp; double tx, ty; //coordinates of Point T // Since we will use slope calculations, horizontal or vertical lines // have to be handled separately to avoid dividing by 0. xtemp = (x[PB]-x[PC])*(x[PB]-x[PC]); if (xtemp > 0) { // not vertical xtemp = (y[PB]-y[PC])*(y[PB]-y[PC]); if ( xtemp > 0) { // not horizontal mslope = (y[PC] - y[PB])/(x[PC] - x[PB]); // slope of line //plot a perpendicular line through pt. A // First, find any point on this line tx = x[PA] + 1; ty = y[PA] - 1/mslope; // Then intersection of the 2 lines (Point T) 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); // Here is a special function that calculates the third leg // of a right triangle. First two inputs give the two ends // of one short leg. The third input is the hypotenuse // (here, it equals the dradius of the circle) // Won't work if the line and circle don't intersect! dist2 = interceptline(0, dist1, dradius); // distance from T to // desired point P1 or P2 dist0 = sqrt(1+mslope*mslope); xtemp = dist2/dist0; if (which) { x[PD] = tx+xtemp; // first intersection point y[PD] = ty+ xtemp*mslope; } else { x[PD] = tx-xtemp; // second intersection point y[PD] = ty- xtemp*mslope; } } else // horizontal line { x[PD] = 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 //vertical line { y[PD] = 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); } } } //////////////////////////////////////////// // These 3 routines find the length of an xarc, given the array // numbers of the 3 points that // make it up. // These variables needed for routine fts double xar[13], yar[13]; double rx, ry; arclength(double start, double corner, double end) { double ct, last_x, last_y; double a_dist; last_x = x[start]; last_y = y[start]; a_dist=0; // For each of the segments that comprises the arc, find // the endpoints of the segment and add the segment length // to the total for (ct=1; ct < 12; ct = ct + 1) { fts(start, corner, end, ct); a_dist = a_dist + distance(rx, ry, last_x, last_y); last_x=rx; last_y=ry; } return a_dist; } ////////////////////////////////////// // These global variables are used by fts for repeated calls. double A1, A2, B1, B2; //transformation vectors double sx, sy, cx, cy, ex, ey; double t0[2], t1[2]; double ftc[2]; fts(double start, double corner, double end, double pos) { if (pos<1) { rx=x[start]; ry=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; t0[0]=A1; t0[1]=B1; t1[0]=A2; t1[1]=B2; ftc[0]= cx + (t0[0] + t0[1]); ftc[1]= cy + (t1[0] + t1[1]); rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; ry = t1[0]*(xar[pos])+t1[1]*(yar[pos])+ ftc[1]; } else {if (pos>10) { rx=x[end]; ry=y[end]; } else { rx = t0[0]*(xar[pos])+t0[1]*(yar[pos])+ ftc[0]; ry = t1[0]*(xar[pos])+t1[1]*(yar[pos])+ ftc[1]; }}} } /////////////////////////////////////// init_xarc_array() { // Must be called before calling fts(). This routine // sets the values in an array of sines and cosines. // You only need to call this routine once. double ang_start, ang_end, step, theta, ct; double XARC_PIECES; XARC_PIECES = 12; ang_start = -3.14159/2; ang_end= -3.14159; ct=0; step= (ang_end - ang_start)/(XARC_PIECES-1); for (theta=ang_start; ct < XARC_PIECES; theta = theta + step) { xar[ct] = cos(theta); yar[ct] = sin(theta); ct=ct+1; } //end init_xarc_array } 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; } } offset_dist(double previous, double base, double next, double target, double odistp, double odistn, double iside) { // offset_dist: calculates the location of a point which is offset by a // given seam allowance width from an existing "base" point. Use this // for seam allowances. // Arguments: // previous: the number of the point before the base point in the object. // If base point is the first point of the object, then this will be the // last point of the object // base: The number of the point that the offset point is offset from. // next: The number of the point after the base point in the object. // If base point is the last point of the object, then this will be the // first point. // target: The number of the offset point. This is the output. // odistp: Distance of offset (seam width) of seam on "previous" side // odistn: Distance of offet (seam width) of seam on "next" side // iside: 0 = offset on left side // 1 = offset on right side double prev_ang, next_ang; double temp_ang; double sin_ang, off_dist; prev_ang = angle(x[base], y[base], x[previous], y[previous]); next_ang = angle(x[base], y[base], x[next], y[next]); prev_ang = normalizeangle(prev_ang); next_ang = normalizeangle(next_ang); if (prev_ang>next_ang) { temp_ang=(prev_ang+next_ang)/2;} else { temp_ang=(prev_ang+next_ang)/2+3.1416;} if (iside > 0) {temp_ang = temp_ang + 3.1416;} // sin_ang=fabs(sin(prev_ang-temp_ang)); sin_ang=sin(prev_ang-temp_ang); if (sin_ang < 0) { sin_ang = -sin_ang;} // The limit here (.1) means that for very sharp angles, the offset distance // will never be more than 10 times the seam width (odistp/.1) if (sin_ang < .1) {off_dist=odistp;} else {off_dist=odistp/sin_ang;} polar(x[base], y[base], temp_ang, off_dist); x[target] = getresultx(); y[target] = getresulty(); // New point is now in correct position for an even offset. // Move new point to account for 2 different offset values // Won't work if we had to limit distance above if (sin_ang < .1) {} else { polar(x[target], y[target], prev_ang, (odistn-odistp)/sin(next_ang - prev_ang)); x[target] = getresultx(); y[target] = getresulty(); } }