64 run(
"parallel(2 seg)",
false,
69 author( b, T::PARALLEL, { whole( s1 ), whole( s2 ) } );
71 run(
"perpendicular(2 seg)",
false,
76 author( b, T::PERPENDICULAR, { whole( s1 ), whole( s2 ) } );
78 run(
"horizontal(1 seg)",
false,
82 author( b, T::HORIZONTAL, { whole( s ) } );
84 run(
"vertical(1 seg)",
false,
88 author( b, T::VERTICAL, { whole( s ) } );
90 run(
"collinear(2 seg)",
false,
95 author( b, T::COLLINEAR, { whole( s1 ), whole( s2 ) } );
97 run(
"equal_length(2 seg)",
false,
102 author( b, T::EQUAL_LENGTH, { whole( s1 ), whole( s2 ) } );
104 run(
"fixed_length(1 seg)",
false,
108 author( b, T::FIXED_LENGTH, { whole( s ) }, 10.0 *
MM );
110 run(
"angular(2 seg)",
false,
115 author( b, T::ANGULAR_DIMENSION, { whole( s1 ), whole( s2 ) }, 90.0 );
117 run(
"concentric(2 circ)",
false,
122 author( b, T::CONCENTRIC, { whole( c1 ), whole( c2 ) } );
124 run(
"equal_radius(2 circ)",
false,
129 author( b, T::EQUAL_RADIUS, { whole( c1 ), whole( c2 ) } );
131 run(
"fixed_radius(1 circ)",
false,
135 author( b, T::FIXED_RADIUS, { whole( c ) }, 8.0 *
MM );
137 run(
"tangent(line,circ)",
false,
142 author( b, T::TANGENT, { whole( s ), whole( c ) } );
144 run(
"tangent(2 circ)",
false,
149 author( b, T::TANGENT, { whole( c1 ), whole( c2 ) } );
153 run(
"parallel+perpendicular",
true,
158 author( b, T::PARALLEL, { whole( s1 ), whole( s2 ) } );
159 author( b, T::PERPENDICULAR, { whole( s1 ), whole( s2 ) } );
161 run(
"horizontal+vertical",
true,
165 author( b, T::HORIZONTAL, { whole( s ) } );
166 author( b, T::VERTICAL, { whole( s ) } );
168 run(
"collinear+perpendicular",
true,
173 author( b, T::COLLINEAR, { whole( s1 ), whole( s2 ) } );
174 author( b, T::PERPENDICULAR, { whole( s1 ), whole( s2 ) } );
176 run(
"equal_radius+two fixed_radius",
true,
181 author( b, T::EQUAL_RADIUS, { whole( c1 ), whole( c2 ) } );
182 author( b, T::FIXED_RADIUS, { whole( c1 ) }, 5.0 *
MM );
183 author( b, T::FIXED_RADIUS, { whole( c2 ) }, 9.0 *
MM );
187 run(
"horiz+horiz+parallel(redundant)",
false,
192 author( b, T::HORIZONTAL, { whole( s1 ) } );
193 author( b, T::HORIZONTAL, { whole( s2 ) } );
194 author( b, T::PARALLEL, { whole( s1 ), whole( s2 ) } );
198 run(
"perpendicular(locked+free)",
false,
204 author( b, T::PERPENDICULAR, { whole( lk ), whole( fr ) } );
206 run(
"parallel+perp(locked+free)",
true,
212 author( b, T::PARALLEL, { whole( lk ), whole( fr ) } );
213 author( b, T::PERPENDICULAR, { whole( lk ), whole( fr ) } );
257 auto parallelErr = [&]()
259 VECTOR2I da = a->GetEnd() - a->GetStart();
260 VECTOR2I dc = c->GetEnd() - c->GetStart();
261 double cross = (double) da.
x * dc.
y - (
double) da.
y * dc.
x;
265 BOOST_CHECK_LE( parallelErr(), 1e-3 );
268 BOOST_CHECK_GT( parallelErr(), 0.1 );
270 std::vector<PCB_SHAPE*> shapes{ c }, mod;
278 BOOST_CHECK_LE( parallelErr(), 0.05 );