Online Appendix 1 The following is an example of a complete plan fragment for a line-segment that is generated by the system. One end-point of the line-segment is fixed and a new constraint that needs to be satisfied is that the second end-point be on a given one-dimensional locus. The solution involves rotation of the line-segment about the fixed end-point followed by a scale operation. This example is given to provide a feel for the complexity of the plan fragment library and the justification for automating its construction. Problem Specification: ---------------------- Geom-Type: line-segment ---------- Name: \$lseg ----- Invariants: (INVARIANT-POINT \$LSEG (>> \$LSEG END1) \$GLB-COORDS1) ----------- To-be-achieved: ((1D-CONSTRAINED-POINT \$LSEG (>> \$LSEG END1) \$1D-LOCUS3)) --------------- Skeletal solution produced by Phase I: -------------------------------------- (rotate \$LSEG (>> \$LSEG END1) ?ANY-AXIS ?ANY-AMT) (scale \$LSEG (>> \$LSEG END1) (TIMES (>> (v- (0D-INTERSECTION (LINE-LOCUS (>> \$LSEG END2) (>> \$LSEG DIRECTION)) \$1D-LOCUS4) END2) MAGNITUDE) (COSINE (ANGLE-BETWEEN (>> (v- (0D-INTERSECTION (LINE-LOCUS (>> \$LSEG END2) (>> \$LSEG DIRECTION)) \$1D-LOCUS4) END2) DIRECTION) (>> \$LSEG DIRECTION))))) Complete plan fragment generated by Phase II: --------------------------------------------- void pf_02111_end2_1d(Cgeom& selected_geom, Sconstraint *new_constraint) { Clseg chosen(selected_geom); Solution cur_sln, next_sln; Sdirect LLdirec7343874; Spoint LLthru_point7343874; int S_ZDflag917984 = 0; int S_ZDmotion917984; int S_ZDint917984; int S_ZDinterval917984; Cgeom *ZDlocus2917984; Cgeom *ZDlocus1917984; Spoint Vto_point50999; Spoint Vfrom_point50999; Cvector *SUBvector250998; Sdirect ABangle21342; Sdirect ABangle11342; double CIarg67; Sdirect LLdirec9090; Spoint LLthru_point9090; int S_ZDflag1136 = 0; int S_ZDmotion1136; int S_ZDint1136; int S_ZDinterval1136; Cgeom *ZDlocus21136; Cgeom *ZDlocus11136; Spoint Vto_point63; Spoint Vfrom_point63; Cvector *SUBvector162; double Tscalar35; double Tscalar25; double Tscalar15; int end; double scale_amount; Spoint scale_point; double var_angle22; int R_angle_flag22 = 0; int R_angle_motion22; int R_angle_int22; int R_angle_interval22; double rot_radians; Spoint rot_point; Spoint trans_point2; SSignature *ssign = new SSignature; SSignature *ss; Sconstraint *temp_constraint = new Sconstraint; Cgeom new_geom(*new_constraint->cgm); *temp_constraint = *new_constraint; ssign->next = NULL; ssign->sconstraint = temp_constraint; ssign->sigNo = 101111; init_sln(&cur_sln); cur_sln.trans_count = 0; init_sln(&next_sln); next_sln.rot_loc = 1; next_sln.rot_count = 1; rot_point = get_point(&chosen, END1, &next_sln, R); next_sln.rot_point = rot_point; /**** rot_axis is ignored here ****/ R_angle_interval22 = count_angles(); R_angle_motion22 = 9999999;for (R_angle_int22 = 0; R_angle_int22 < R_angle_interval22; R_angle_int22++) { if ((R_angle_motion22 <= cur_sln.motion) && (R_angle_flag22 > 1)) break; else if (R_angle_motion22 > cur_sln.motion) { R_angle_motion22 = cur_sln.motion; R_angle_flag22++; } var_angle22 = get_angles(R_angle_interval22, R_angle_int22); rot_radians = var_angle22; next_sln.rot_amount = rot_radians; next_sln.scl_loc = 2; next_sln.scl_count = 1; scale_point = get_point(&chosen, END1, &next_sln, S); end = END1; next_sln.scl_point = scale_point; Vfrom_point63 = get_point(&chosen, END2, &next_sln, S); LLthru_point9090 = get_point(&chosen, END2, &next_sln, S); LLdirec9090 = get_direction(&chosen, &next_sln, S); Clseg LLline9090(&LLthru_point9090, 100, &LLdirec9090); ZDlocus11136 = &LLline9090; ZDlocus21136 = &new_geom; S_ZDinterval1136 = count_0d_intersection(ZDlocus11136, ZDlocus21136); if (next_sln.scl_count) next_sln.scl_count *= S_ZDinterval1136; else next_sln.scl_count = S_ZDinterval1136; S_ZDmotion1136 = 9999999;for (S_ZDint1136 = 0; S_ZDint1136 < S_ZDinterval1136; S_ZDint1136++) { if ((S_ZDmotion1136 <= cur_sln.motion) && (S_ZDflag1136 > 1)) break; else if (S_ZDmotion1136 > cur_sln.motion) { S_ZDmotion1136 = cur_sln.motion; S_ZDflag1136++; } Vto_point63 = get_0d_intersection(ZDlocus11136, ZDlocus21136, S_ZDinterval1136, S_ZDint1136, &next_sln); Cvector Vvect63(&Vfrom_point63, &Vto_point63); SUBvector162 = &Vvect63; Tscalar15 = SUBvector162->magnitude(); Vfrom_point50999 = get_point(&chosen, END2, &next_sln, S); LLthru_point7343874 = get_point(&chosen, END2, &next_sln, S); LLdirec7343874 = get_direction(&chosen, &next_sln, S); Clseg LLline7343874(&LLthru_point7343874, 100, &LLdirec7343874); ZDlocus1917984 = &LLline7343874; ZDlocus2917984 = &new_geom; S_ZDinterval917984 = count_0d_intersection(ZDlocus1917984, ZDlocus2917984); if (next_sln.scl_count) next_sln.scl_count *= S_ZDinterval917984; else next_sln.scl_count = S_ZDinterval917984; S_ZDmotion917984 = 9999999;for (S_ZDint917984 = 0; S_ZDint917984 < S_ZDinterval917984; S_ZDint917984++) { if ((S_ZDmotion917984 <= cur_sln.motion) && (S_ZDflag917984 > 1)) break; else if (S_ZDmotion917984 > cur_sln.motion) { S_ZDmotion917984 = cur_sln.motion; S_ZDflag917984++; } Vto_point50999 = get_0d_intersection(ZDlocus1917984, ZDlocus2917984, S_ZDinterval917984, S_ZDint917984, &next_sln); Cvector Vvect50999(&Vfrom_point50999, &Vto_point50999); SUBvector250998 = &Vvect50999; ABangle11342 = *(SUBvector250998->direction()); ABangle21342 = get_direction(&chosen, &next_sln, S); CIarg67 = compute_angle_between(&ABangle21342, &ABangle11342, &next_sln); Tscalar25 = compute_cosinv(CIarg67, end); Tscalar35 = get_length(&chosen, &next_sln, S); scale_amount = Tscalar15 * Tscalar25 + Tscalar35; next_sln.scl_amount = scale_amount; measure_motion(&next_sln, &chosen); if (next_sln.motion < cur_sln.motion) { cur_sln = next_sln; } } } } if (!cur_sln.rot_count || !cur_sln.scl_count || !cur_sln.trans_count) { printf("No action taken\n"); printf("no other planFrags to use\n"); } else { chosen.geomRotate(&cur_sln.rot_point, &(cur_sln.normal), cur_sln.rot_amount); chosen.geomScale(&cur_sln.scl_point, cur_sln.scl_amount); for(ss=&(selected_geom.geomSignature); ss && ss->next; ss = ss->next); ss->next = ssign; selected_geom.assignPts(chosen.end1(),chosen.end2(),chosen.end2(),LSEG); } }