// Copyright (C) 2001 Leena L�hteenm�ki, Finland // Copyright (C) 2012 PatternMaker Software // 2012/08/14 //check abbreviations measures hip hipH double index, done; object marker_array[20]; double marker_count, loop; double result; double x[200], y[200]; object group_obj[50]; point current_point; object current_object; selection current_selection; double texts, grouping; double waist,hip,length,crotch,abdm,abdmH,hipH,cuff; double second_dart, first_dart, back_dart; double metric; double model,waist_model,raised, slit; double pocket; double zipper,zipper_length; double text; double language; double test; double pleats; double siirtox, siirtoy; double ang, ang2; double sv, round_abdomen; double polvikorkeus; double ease, f_waist[3],f_abdm[3],f_hip[3]; double korotus, vy_kellotus; main() { language=get_language(); if ( language != 0 ) { language = 0; } if (language == 0) { check_reg(0, "Leena","Maternity", "This macro needs to be properly installed before running it."); } // index = 0; while (!done) { if (index==0) { Popup1(); } if (index==1) { Popup2(); } } waist=78; hip=102; hipH=19; length=106; zipper_length=20; crotch=27.8; cuff=38; sv=1; vy_kellotus=6; korotus=3; abdm=hip; abdmH=9; waist=hip-4; crotch=crotch-1; if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { waist=waist/2.54; hip=hip/2.54; abdm=abdm/2.54; length=length/2.54; zipper_length=zipper_length/2.54; crotch=crotch/2.54; abdmH=abdmH/2.54; hipH=hipH/2.54; cuff=cuff/2.54; korotus=korotus/2.54; vy_kellotus=vy_kellotus/2.54; sv=sv/2.54; } } else { if (language == 0) { metric=2*pop_up("UNITS","Inches","Centimeters"); } if (metric<1) { waist=waist/2.54; hip=hip/2.54; abdm=abdm/2.54; length=length/2.54; zipper_length=zipper_length/2.54; crotch=crotch/2.54; abdmH=abdmH/2.54; hipH=hipH/2.54; cuff=cuff/2.54; korotus=korotus/2.54; vy_kellotus=vy_kellotus/2.54; sv=sv/2.54; } } if(metric==0) { sv=0.39; } f_waist[0]=waist+2; f_abdm[0]=abdm+4; f_hip[0]=hip+4; f_waist[1]=waist+1; f_abdm[1]=abdm+2; f_hip[1]=hip+2; f_waist[2]=waist+3; f_abdm[2]=abdm+6; f_hip[2]=hip+6; waist=f_waist[ease]; abdm=f_abdm[ease]; hip=f_hip[ease]; double read; read = 0; if (is_function("measure_table")==1) { if (measure_table("default_women")==1) { read = 1; } } if (read==0) { if (is_function("start_picture_input")) { start_picture_input("MATERNITY PANTS"); add_picture_input("Hip Circ.",hip, "w_meas_hipcirc"); add_picture_input("Waist - Hip",hipH, "w_meas_waist-hip"); add_picture_input("Crotch depth", crotch, "w_meas_crotch_dpt"); run_picture_input(); } else { if (language == 0) { dialog_box( "MATERNITY PANTS", "Hip circ.", hip, "Waist - Hip", hipH, "Crotch depth", crotch); } } } if (is_function("start_picture_input")) { start_picture_input("CUSTOM MEASUREMENTS"); add_picture_input("Outside seam", length,"w_meas_outside"); add_picture_input("Zipper length",zipper_length,"w_meas_zipper"); add_picture_input("Cuff circ.", cuff, "w_meas_cuffcirc"); add_picture_input("Seam allowance", sv, "meas_seamallow"); add_picture_input("Added Front height",korotus,""); add_picture_input("Added Front width",vy_kellotus,""); run_picture_input(); } else { if (language == 0) { dialog_box( "CUSTOM MEASUREMENTS", "Outside seam", length, "Zipper length",zipper_length, "Cuff circ.", cuff, "Seam allowance",sv, "Added Front height",korotus, "Added Front width",vy_kellotus); } } if (is_function("unit_mode")==1) { metric = unit_mode(); if (!metric) { waist=waist*2.54; hip=hip*2.54; abdm=abdm*2.54; length=length*2.54; zipper_length=zipper_length*2.54; crotch=crotch*2.54; abdmH=abdmH*2.54; hipH=hipH*2.54; cuff=cuff*2.54; korotus=korotus*2.54; vy_kellotus=vy_kellotus*2.54; } } else { if (metric<1) { waist=waist*2.54; hip=hip*2.54; abdm=abdm*2.54; length=length*2.54; zipper_length=zipper_length*2.54; crotch=crotch*2.54; abdmH=abdmH*2.54; hipH=hipH*2.54; cuff=cuff*2.54; korotus=korotus*2.54; vy_kellotus=vy_kellotus*2.54; } } if(metric==2) { sv=sv/2.54; } //Start Options //End Options hip=hip+4+2; second_dart=0; first_dart=3; back_dart=2.5; polvikorkeus=80; x[0]=0; y[0]=0; coord(0,1,0,-abdmH); coord(0,2,0,-hipH); coord(0,3,0,-crotch); coord(0,5,0,-length); x[4]=x[5]; y[4]=y[5]+dist(5,3)/2+6; coord(0,6,-waist/8,0); coord(2,7,-(hip/8-2),0); coord(7,8,0,-(crotch-hipH)); coord(8,9,-(hip/20-1)-1,0); cont(8,6,7,-zipper_length); coord(5,10,-(cuff/4-1),0); coord(5,11,(cuff/4-1),0); coord(3,12,hip/8+2,0); coord(2,13,hip/8+2,0); coord(13,14,0,hipH/3*2); x[14]=x[13]+1; coord(0,18,-first_dart/2,0); coord(18,17,+first_dart/2,-abdmH); coord(0,15,waist/8+second_dart+first_dart,1); coord(18,16,+first_dart,0); coord(16,43,+4,0); coord(43,42,second_dart/2,-abdmH+2); coord(43,44,second_dart,0); coord(0,19,-1.5,(hip/20-1.5)); coord(2,20,-(hip/20+1),(hip/20-1.5)); coord(8,21,1,-1.5); coord(8,22,-(hip/20),-1.5); coord(22,23,-(hip/20)+1,0); if((hipH==crotch)||(hipH>crotch)) { cont(21,19,20,-19); } coord(10,24,-2,0); coord(11,25,+2,0); double a, b, c; a=hip/20-1.5; c=hip/4; b=sqrt(c*c-a*a); coord(20,26,b,a); double a, b, c; a=hip/20-1.5; c=hip/4; b=sqrt(c*c-a*a); coord(19,28,b,-a); center (26,28,27); x[27]=x[27]+1; cont(19,28,31,-dist(19,28)/2); cont(19,31,29,back_dart); coord(31,30,0,-14); center(9,10,38); cont(10,38,38,6); x[38]=x[38]+2; coord(38,39,2*dist(38,4),0); coord(38,45,-2,0); coord(39,32,2,0); center(38,9,40); x[40]=x[40]+2; center(45,23,33); x[33]=x[33]+2; x[4]=x[0]; y[4]=y[38]; x[41] = x[14]; y[41] = y[43]- interceptline(x[14],x[43],16.5); x[41]=x[41]-.4; cont(0,15,46,-9); cont(41,15,47,-12); x[47]=x[47]+1; x[48]=x[43]; y[48]=y[47]; cont(39,41,49,-12); coord(17,52,0,-30); line_intersect(17,52,49,40,53); coord(17,54,0,-30); line_intersect(17,54,49,40,55); coord(42,56,0,-30); line_intersect(17,56,49,40,57); coord(0,80,0,0); if(round_abdomen==1) { y[15]=y[15]-1; y[16]=y[16]+3; y[0]=y[0]+3; y[18]=y[18]+2; y[6]=y[6]+3; y[99]=y[99]+2; y[98]=y[99]+2; y[112]=y[112]+2; y[113]=y[113]+2; y[114]=y[114]+2; y[115]=y[115]+2; y[118]=y[118]+2; y[18]=y[18]+1; y[43]=y[43]+1; y[109]=y[109]+2; y[28]=y[28]-1; } y[26]=y[13]; x[14]=x[13]; x[15]=x[13]; coord(0,59,0,korotus); coord(6,60,0,korotus); rotate(59,7,vy_kellotus/dist(59,7)); rotate(60,7,vy_kellotus/dist(60,7)); y[60]=y[59]; y[0]=y[0]+3; y[43]=y[0]; x[61]=x[60]; y[61]=y[1]; cont(27,28,50,3.5); coord(50,51,-1,3.5); cont(20,19,53,3.5); coord(53,52,-1,3.5); cont(41,15,54,3.5); cont(15,54,55,3.5); coord(0,57,0,3.5); coord(57,58,0,3.5); siirtox=0; siirtoy=0; if(model==0) { current_object=newobject("poly"); if(length0) { offset_mark(26); select(current_selection,group_obj[27]); group(current_selection); deselect(current_selection); } else { mark(26); current_selection=newselection("OBJECT"); select(current_selection,group_obj[26]); select(current_selection,group_obj[27]); group(current_selection); deselect(current_selection); } } if (language == 0) { current_object=newobject("text","Pocket mouth",5.469952,0.2,0.2,"SIMP.CHR"); } addpoint((x[43]+1+siirtox)/2.54, (y[43]-2+siirtoy)/2.54, "LINE"); group_obj[2]=current_object; if(model==0) { if (language == 0) { current_object=newobject("text","Front piece CF, Cut 2",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[61]+3+siirtox)/2.54, (y[61]+siirtoy)/2.54, "line"); group_obj[3]=current_object; } if (language == 0) { current_object=newobject("text","Check cuff seam allowance",0.0,0.2,0.2,"SIMP.CHR"); } addpoint((x[10]+.2+siirtox)/2.54, (y[10]+1+siirtoy)/2.54, "line"); group_obj[4]=current_object; current_object=newobject("poly"); addpoint((x[17])/2.54, (y[17])/2.54, "line"); addpoint((x[5])/2.54, (y[5]+.5)/2.54, "open"); group_obj[5]=current_object; if (language == 0) { current_object=newobject("text","Front piece, Cut 2, Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[0]+.2+siirtox)/2.54, (y[2]+siirtoy)/2.54, "line"); group_obj[6]=current_object; if(sv>0) { offset_mark(1); select(current_selection,group_obj[2]); if(model==0) { select(current_selection,group_obj[3]); } select(current_selection,group_obj[4]); select(current_selection,group_obj[5]); select(current_selection,group_obj[6]); 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]); if(model==0) { select(current_selection,group_obj[3]); } select(current_selection,group_obj[4]); select(current_selection,group_obj[5]); select(current_selection,group_obj[6]); group(current_selection); deselect(current_selection); } siirtox=-10; siirtoy=16; double vyotaronauhan_pituus; vyotaronauhan_pituus=dist(43,0)+dist(0,59)+dist(59,60); current_object=newobject("poly"); addpoint((x[60]+siirtox)/2.54, (y[60]+siirtoy)/2.54, "LINE"); current_point=addpoint((x[60]+siirtox+vyotaronauhan_pituus)/2.54, (y[60]+siirtoy)/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[60]+siirtox+2*vyotaronauhan_pituus)/2.54, (y[60]+siirtoy)/2.54, "LINE"); addpoint((x[60]+siirtox+2*vyotaronauhan_pituus)/2.54, (y[60]+7+siirtoy)/2.54, "LINE"); current_point=addpoint((x[60]+siirtox+vyotaronauhan_pituus)/2.54, (y[60]+7+siirtoy)/2.54, "LINE"); notch_type(current_point,"NOTCH",1); addpoint((x[60]+siirtox)/2.54, (y[60]+7+siirtoy)/2.54, "LINE"); group_obj[7]=current_object; if (language == 0) { current_object=newobject("text","CF, Front Waistband, Cut 1",0.0,0.2,0.2,"SIMP.CHR"); } current_point=addpoint((x[60]+siirtox+vyotaronauhan_pituus)/2.54, (y[60]+3+siirtoy)/2.54, "LINE"); group_obj[8]=current_object; if(sv>0) { offset_mark(7); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } else { mark(7); current_selection=newselection("OBJECT"); select(current_selection,group_obj[7]); select(current_selection,group_obj[8]); group(current_selection); deselect(current_selection); } siirtox=+hip/2; siirtoy=1.5*crotch; current_object=newobject("poly"); addpoint((x[43]-2+siirtox)/2.54, (y[43]-1+siirtoy)/2.54, "LINE"); addpoint((x[43]-2+siirtox)/2.54, (y[43]-10+siirtoy)/2.54, "open"); group_obj[9]=current_object; if (language == 0) { current_object=newobject("text","Pocket lining, Cut 2, Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[43]-2+0.3+siirtox)/2.54, (y[43]-1+siirtoy)/2.54, "LINE"); group_obj[10]=current_object; current_object=newobject("poly"); current_point=addpoint((x[49]+siirtox)/2.54, (y[49]+siirtoy)/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[13]+siirtox)/2.54, (y[13]+siirtoy)/2.54, "xarc_corner"); current_point=addpoint((x[41]+siirtox)/2.54, (y[41]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[43]+siirtox)/2.54, (y[43]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[0]+siirtox)/2.54, (y[0]+siirtoy)/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[9]+siirtox)/2.54, (y[9]+siirtoy)/2.54, "xarc_corner"); group_obj[11]=current_object; if (language == 0) { current_object=newobject("text","Pocket mouth",5.469952,0.2,0.2,"SIMP.CHR"); } addpoint((x[43]+1+siirtox)/2.54, (y[43]-2+siirtoy)/2.54, "LINE"); group_obj[12]=current_object; if(sv>0) { offset_mark(11); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); } else { mark(11); current_selection=newselection("OBJECT"); select(current_selection,group_obj[11]); select(current_selection,group_obj[9]); select(current_selection,group_obj[10]); select(current_selection,group_obj[12]); group(current_selection); deselect(current_selection); } siirtox=+hip/2+25; siirtoy=1.5*crotch; current_object=newobject("poly"); current_point=addpoint((x[43]+siirtox)/2.54, (y[43]-1+siirtoy)/2.54, "LINE"); addpoint((x[43]+siirtox)/2.54, (y[43]-10+siirtoy)/2.54, "open"); group_obj[13]=current_object; if (language == 0) { current_object=newobject("text","Pocket bag, Cut 2, Grainline",-1.570796,0.2,0.2,"SIMP.CHR"); } addpoint((x[43]+0.3+siirtox)/2.54, (y[43]-1+siirtoy)/2.54, "LINE"); group_obj[14]=current_object; current_object=newobject("poly"); current_point=addpoint((x[49]+siirtox)/2.54, (y[49]+siirtoy)/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[13]+siirtox)/2.54, (y[13]+siirtoy)/2.54, "xarc_corner"); current_point=addpoint((x[41]+siirtox)/2.54, (y[41]+siirtoy)/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[14]+siirtox)/2.54, (y[14]+siirtoy)/2.54, "xarc_corner"); current_point=addpoint((x[15]+siirtox)/2.54, (y[15]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[54]+siirtox)/2.54, (y[54]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[55]+siirtox)/2.54, (y[55]+siirtoy)/2.54, "line"); current_point=addpoint((x[43]+siirtox)/2.54, (y[43]+7+siirtoy)/2.54, "line"); current_point=addpoint((x[58]+siirtox)/2.54, (y[58]+siirtoy)/2.54, "line"); current_point=addpoint((x[57]+siirtox)/2.54, (y[57]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[0]+siirtox)/2.54, (y[0]+siirtoy)/2.54, "xarc_start"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[9]+siirtox)/2.54, (y[9]+siirtoy)/2.54, "xarc_corner"); group_obj[15]=current_object; current_object=newobject("poly"); current_point=addpoint((x[0]+siirtox)/2.54, (y[0]+siirtoy)/2.54, "line"); current_point=addpoint((x[43]+siirtox)/2.54, (y[43]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[15]+siirtox)/2.54, (y[15]+siirtoy)/2.54, "open"); group_obj[22]=current_object; if(sv>0) { offset_mark(15); select(current_selection,group_obj[13]); select(current_selection,group_obj[14]); select(current_selection,group_obj[22]); group(current_selection); deselect(current_selection); } else { mark(15); current_selection=newselection("OBJECT"); select(current_selection,group_obj[15]); select(current_selection,group_obj[13]); select(current_selection,group_obj[14]); select(current_selection,group_obj[22]); group(current_selection); deselect(current_selection); } siirtox=hip/2+6; siirtoy=0; current_object=newobject("poly"); current_point=addpoint((x[19]+siirtox)/2.54, (y[19]+siirtoy)/2.54, "line"); notch_type(current_point,"NOTCH",1); current_point=addpoint((x[20]+siirtox)/2.54, (y[20]+siirtoy)/2.54, "XARC_START"); current_point=addpoint((x[21]+siirtox)/2.54, (y[21]+siirtoy)/2.54, "XARC_CORNER"); current_point=addpoint((x[22]+siirtox)/2.54, (y[22]+siirtoy)/2.54, "LINE"); if(length0) { offset_mark(16); select(current_selection,group_obj[17]); select(current_selection,group_obj[18]); select(current_selection,group_obj[19]); select(current_selection,group_obj[20]); select(current_selection,group_obj[21]); select(current_selection,group_obj[26]); group(current_selection); deselect(current_selection); } else { mark(16); current_selection=newselection("OBJECT"); select(current_selection,group_obj[16]); select(current_selection,group_obj[17]); select(current_selection,group_obj[18]); select(current_selection,group_obj[19]); select(current_selection,group_obj[20]); select(current_selection,group_obj[21]); select(current_selection,group_obj[26]); 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"); } 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 cdistance) { double ang; ang=angle(x[cstart], y[cstart], x[cend], y[cend]); polar(x[cend], y[cend], ang, cdistance); 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 == 2) { done = 1; } } Backward() { index = index - 1; } Popup1() { start_pict_dialog("PANTS MODEL"); add_pict_item("Plain front", "mn_pants_plain.jpg"); add_pict_item("Elastic panel", "mn_pants_panel.jpg"); run_pict("Next"); model = get_pict_result(); Forward(); } Popup2() { start_pict_dialog("HIP EASE"); add_pict_item("Normal (+1.5in/+4cm)", "blank.jpg"); add_pict_item("Minimum (+0.75in/+2 cm)", "blank.jpg"); add_pict_item("Maximum (+2.5in/+6 cm)", "blank.jpg"); run_pict("Back","Next"); ease = get_pict_result(); Forward(); } 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"); } 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(); } newobj_dot() { line("CENTER_LINE"); newobject("poly"); line("SOLID_LINE"); } 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); } } }