Branch data Line data Source code
1 : : #include "meshkit/AF2DfltTriangleRules.hpp"
2 : :
3 : : // C++
4 : : #include <list>
5 : :
6 : : // MeshKit
7 : : #include "meshkit/AF2FreeZoneDef.hpp"
8 : : #include "meshkit/AF2FreeZoneDefLCQualLim.hpp"
9 : : #include "meshkit/AF2FreeZoneDefSimple.hpp"
10 : : #include "meshkit/AF2PntTrnsfrmLnrV.hpp"
11 : : #include "meshkit/AF2Point2D.hpp"
12 : : #include "meshkit/AF2PointTransformNone.hpp"
13 : : #include "meshkit/AF2RuleExistEdge.hpp"
14 : : #include "meshkit/AF2RuleExistVertex.hpp"
15 : : #include "meshkit/AF2RuleNewEdge.hpp"
16 : : #include "meshkit/AF2RuleNewFace.hpp"
17 : : #include "meshkit/AF2RuleNewTriangle.hpp"
18 : : #include "meshkit/AF2RuleNewVertex.hpp"
19 : : #include "meshkit/Error.hpp"
20 : :
21 : 44 : AF2DfltTriangleRules::AF2DfltTriangleRules()
22 : : {
23 [ + - ][ + - ]: 22 : ruleList.push_back(make180DegreeRuleQ1());
24 [ + - ][ + - ]: 22 : ruleList.push_back(make180DegreeRuleQ5());
25 [ + - ][ + - ]: 22 : ruleList.push_back(make180DegreeRuleQ10());
26 [ + - ][ + - ]: 22 : ruleList.push_back(make180DegreeRuleQ20());
27 [ + - ][ + - ]: 22 : ruleList.push_back(make60DegreeAngleRightRule());
28 [ + - ][ + - ]: 22 : ruleList.push_back(make60DegreeAngleLeftRule());
29 [ + - ][ + - ]: 22 : ruleList.push_back(make120DegreeAngleRightRule());
30 [ + - ][ + - ]: 22 : ruleList.push_back(make120DegreeAngleLeftRule());
31 [ + - ][ + - ]: 22 : ruleList.push_back(make120DegreeAngleBothRule());
32 [ + - ][ + - ]: 22 : ruleList.push_back(makeFillTriangleRule());
33 [ + - ][ + - ]: 22 : ruleList.push_back(makeConnectVertexRule());
34 [ + - ][ + - ]: 22 : ruleList.push_back(makeConnectEdgeRule());
35 : 22 : }
36 : :
37 : 44 : AF2DfltTriangleRules::~AF2DfltTriangleRules()
38 : : {
39 : : typedef std::list<const AF2Rule*>::iterator RuleListItr;
40 [ + + ]: 286 : for (RuleListItr itr = ruleList.begin(); itr != ruleList.end(); ++itr)
41 : : {
42 [ + - ]: 264 : delete *itr;
43 : : }
44 : 22 : }
45 : :
46 : 0 : AF2DfltTriangleRules::AF2DfltTriangleRules(const AF2DfltTriangleRules & toCopy)
47 : : {
48 [ # # ]: 0 : MeshKit::Error notImpl(MeshKit::MK_NOT_IMPLEMENTED);
49 : : notImpl.set_string(
50 [ # # ]: 0 : "AF2DfltTriangleRules copy constructor is not supported.");
51 [ # # ]: 0 : throw notImpl;
52 : : }
53 : :
54 : 0 : AF2DfltTriangleRules& AF2DfltTriangleRules::operator=(const AF2DfltTriangleRules & rhs)
55 : : {
56 [ # # ]: 0 : MeshKit::Error notImpl(MeshKit::MK_NOT_IMPLEMENTED);
57 : : notImpl.set_string(
58 [ # # ]: 0 : "AF2DfltTriangleRules assignment operator is not supported.");
59 [ # # ]: 0 : throw notImpl;
60 : : }
61 : :
62 : 22 : std::list<const AF2Rule*> AF2DfltTriangleRules::getRules() const
63 : : {
64 : 22 : return ruleList;
65 : : }
66 : :
67 : 286 : AF2PntTrnsfrmLnrV* AF2DfltTriangleRules::makeLinearTransformX(
68 : : const AF2RuleExistVertex* ruleExVert, double xCoeff) const
69 : : {
70 [ + - ]: 286 : std::list<const AF2RuleExistVertex*> vertexList;
71 [ + - ]: 572 : std::list<double> xCoeffList;
72 [ + - ]: 572 : std::list<double> yCoeffList;
73 : :
74 [ + - ]: 286 : vertexList.push_back(ruleExVert);
75 [ + - ]: 286 : xCoeffList.push_back(xCoeff);
76 [ + - ]: 286 : xCoeffList.push_back(0.0);
77 [ + - ]: 286 : yCoeffList.push_back(0.0);
78 [ + - ]: 286 : yCoeffList.push_back(0.0);
79 : :
80 [ + - ][ + - ]: 572 : return new AF2PntTrnsfrmLnrV(vertexList, xCoeffList, yCoeffList);
[ + - ][ + - ]
[ + - ]
81 : : }
82 : :
83 : 286 : AF2PntTrnsfrmLnrV* AF2DfltTriangleRules::makeTranslation(
84 : : const AF2RuleExistVertex* ruleExVert) const
85 : : {
86 [ + - ]: 286 : std::list<const AF2RuleExistVertex*> vertexList;
87 [ + - ]: 572 : std::list<double> xCoeffList;
88 [ + - ]: 572 : std::list<double> yCoeffList;
89 : :
90 [ + - ]: 286 : vertexList.push_back(ruleExVert);
91 [ + - ]: 286 : xCoeffList.push_back(1.0);
92 [ + - ]: 286 : xCoeffList.push_back(0.0);
93 [ + - ]: 286 : yCoeffList.push_back(0.0);
94 [ + - ]: 286 : yCoeffList.push_back(1.0);
95 : :
96 [ + - ][ + - ]: 572 : return new AF2PntTrnsfrmLnrV(vertexList, xCoeffList, yCoeffList);
[ + - ][ + - ]
[ + - ]
97 : : }
98 : :
99 : 22 : const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ1() const
100 : : {
101 : : // define the vertices that must exist
102 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
103 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
104 : :
105 : : // assemble the vertices that must exist into a list
106 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
107 [ + - ]: 22 : existVertices.push_back(originExist);
108 [ + - ]: 22 : existVertices.push_back(baseExist);
109 : :
110 : : // define the baseline edge that must exist
111 : : const AF2RuleExistEdge* baseEdge =
112 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
113 : :
114 : : // define the other edges that must exist
115 : :
116 : : // assemble the non-baseline edges that must exist into a list
117 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
118 : :
119 : : // define the reference preferred boundary points of the free zone
120 : : // and assemble them into a list
121 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
122 : 22 : double prefXCoord[5] = {0.0, 1.0, 1.5, 0.5, -0.5};
123 : 22 : double prefYCoord[5] = {0.0, 0.0, 0.7, 1.5, 0.7};
124 [ + + ]: 132 : for (unsigned int pbpi = 0u; pbpi < 5u; ++pbpi)
125 : : {
126 [ + - ]: 110 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
127 [ + - ]: 110 : prefBndryPnts.push_back(bndryPnt);
128 : : }
129 : :
130 : : // define the point transforms that apply to the preferred
131 : : // boundary points of the free zone and assemble them into a list
132 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
133 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
134 : : AF2PointTransform* baseXTransform =
135 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
136 : : AF2PointTransform* halfBaseXTransform =
137 [ + - ]: 22 : makeLinearTransformX(baseExist, 0.5);
138 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
139 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
140 [ + - ]: 22 : prefBndryTrnsfrms.push_back(halfBaseXTransform);
141 [ + - ]: 22 : prefBndryTrnsfrms.push_back(halfBaseXTransform);
142 [ + - ]: 22 : prefBndryTrnsfrms.push_back(halfBaseXTransform);
143 : :
144 : : // define the reference limiting boundary points of the free zone
145 : : // and assemble them into a list
146 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
147 : 22 : double limXCoord[5] = {0.0, 1.0, 0.5, 0.5, 0.5};
148 : 22 : double limYCoord[5] = {0.0, 0.0, 0.866, 0.866, 0.866};
149 [ + + ]: 132 : for (unsigned int lbpi = 0u; lbpi < 5u; ++lbpi)
150 : : {
151 [ + - ]: 110 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
152 [ + - ]: 110 : limBndryPnts.push_back(bndryPnt);
153 : : }
154 : :
155 : : // define the point transforms that apply to the limiting
156 : : // boundary points of the free zone and assemble them into a list
157 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
158 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
159 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
160 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
161 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
162 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
163 : :
164 : : // define the free zone definition
165 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
166 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
167 : :
168 : : // define the new vertices that the rule would create and assemble them
169 : : // into a list
170 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
171 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.866);
172 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform));
[ + - ]
173 : :
174 : : // define the new edges and assemble them into a list
175 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
176 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
177 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
178 : :
179 : : // define the new triangles and assemble them into a list
180 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
181 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
182 : :
183 : : // construct the rule itself
184 : : AF2Rule* rule =
185 : : new AF2Rule("Triangle Off Line, Quality Level 1", 1u, existVertices,
186 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
187 : :
188 : : // delete transforms that were allocated with new but cloned when
189 : : // made part of the rule definition
190 [ + - ]: 22 : delete halfBaseXTransform;
191 [ + - ]: 22 : delete baseXTransform;
192 [ + - ]: 22 : delete noTransform;
193 : :
194 : 22 : return rule;
195 : : }
196 : :
197 : 22 : const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ5() const
198 : : {
199 : : // define the vertices that must exist
200 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
201 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
202 : :
203 : : // assemble the vertices that must exist into a list
204 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
205 [ + - ]: 22 : existVertices.push_back(originExist);
206 [ + - ]: 22 : existVertices.push_back(baseExist);
207 : :
208 : : // define the baseline edge that must exist
209 : : const AF2RuleExistEdge* baseEdge =
210 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
211 : :
212 : : // define the other edges that must exist
213 : :
214 : : // assemble the non-baseline edges that must exist into a list
215 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
216 : :
217 : : // define the reference preferred boundary points of the free zone
218 : : // and assemble them into a list
219 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
220 : 22 : double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0};
221 : 22 : double prefYCoord[4] = {0.0, 0.0, 0.7, 0.7};
222 [ + + ]: 110 : for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi)
223 : : {
224 [ + - ]: 88 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
225 [ + - ]: 88 : prefBndryPnts.push_back(bndryPnt);
226 : : }
227 : :
228 : : // define the point transforms that apply to the preferred
229 : : // boundary points of the free zone and assemble them into a list
230 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
231 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
232 : : AF2PointTransform* baseXTransform =
233 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
234 : : AF2PointTransform* halfBaseXTransform =
235 [ + - ]: 22 : makeLinearTransformX(baseExist, 0.5);
236 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
237 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
238 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
239 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
240 : :
241 : : // define the reference limiting boundary points of the free zone
242 : : // and assemble them into a list
243 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
244 : 22 : double limXCoord[4] = {0.0, 1.0, 0.5, 0.5};
245 : 22 : double limYCoord[4] = {0.0, 0.0, 0.5, 0.5};
246 [ + + ]: 110 : for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi)
247 : : {
248 [ + - ]: 88 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
249 [ + - ]: 88 : limBndryPnts.push_back(bndryPnt);
250 : : }
251 : :
252 : : // define the point transforms that apply to the limiting
253 : : // boundary points of the free zone and assemble them into a list
254 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
255 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
256 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
257 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
258 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
259 : :
260 : : // define the free zone definition
261 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
262 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
263 : :
264 : : // define the new vertices that the rule would create and assemble them
265 : : // into a list
266 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
267 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.5);
268 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform));
[ + - ]
269 : :
270 : : // define the new edges and assemble them into a list
271 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
272 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
273 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
274 : :
275 : : // define the new triangles and assemble them into a list
276 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
277 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
278 : :
279 : : // construct the rule itself
280 : : AF2Rule* rule =
281 : : new AF2Rule("Triangle Off Line, Quality Level 5", 5u, existVertices,
282 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
283 : :
284 : : // delete transforms that were allocated with new but cloned when
285 : : // made part of the rule definition
286 [ + - ]: 22 : delete halfBaseXTransform;
287 [ + - ]: 22 : delete baseXTransform;
288 [ + - ]: 22 : delete noTransform;
289 : :
290 : 22 : return rule;
291 : : }
292 : :
293 : 22 : const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ10() const
294 : : {
295 : : // define the vertices that must exist
296 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
297 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
298 : :
299 : : // assemble the vertices that must exist into a list
300 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
301 [ + - ]: 22 : existVertices.push_back(originExist);
302 [ + - ]: 22 : existVertices.push_back(baseExist);
303 : :
304 : : // define the baseline edge that must exist
305 : : const AF2RuleExistEdge* baseEdge =
306 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
307 : :
308 : : // define the other edges that must exist
309 : :
310 : : // assemble the non-baseline edges that must exist into a list
311 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
312 : :
313 : : // define the reference preferred boundary points of the free zone
314 : : // and assemble them into a list
315 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
316 : 22 : double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0};
317 : 22 : double prefYCoord[4] = {0.0, 0.0, 0.5, 0.5};
318 [ + + ]: 110 : for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi)
319 : : {
320 [ + - ]: 88 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
321 [ + - ]: 88 : prefBndryPnts.push_back(bndryPnt);
322 : : }
323 : :
324 : : // define the point transforms that apply to the preferred
325 : : // boundary points of the free zone and assemble them into a list
326 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
327 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
328 : : AF2PointTransform* baseXTransform =
329 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
330 : : AF2PointTransform* halfBaseXTransform =
331 [ + - ]: 22 : makeLinearTransformX(baseExist, 0.5);
332 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
333 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
334 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
335 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
336 : :
337 : : // define the reference limiting boundary points of the free zone
338 : : // and assemble them into a list
339 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
340 : 22 : double limXCoord[4] = {0.0, 1.0, 0.5, 0.5};
341 : 22 : double limYCoord[4] = {0.0, 0.0, 0.3, 0.3};
342 [ + + ]: 110 : for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi)
343 : : {
344 [ + - ]: 88 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
345 [ + - ]: 88 : limBndryPnts.push_back(bndryPnt);
346 : : }
347 : :
348 : : // define the point transforms that apply to the limiting
349 : : // boundary points of the free zone and assemble them into a list
350 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
351 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
352 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
353 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
354 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
355 : :
356 : : // define the free zone definition
357 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
358 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
359 : :
360 : : // define the new vertices that the rule would create and assemble them
361 : : // into a list
362 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
363 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.3);
364 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform));
[ + - ]
365 : :
366 : : // define the new edges and assemble them into a list
367 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
368 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
369 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
370 : :
371 : : // define the new triangles and assemble them into a list
372 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
373 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
374 : :
375 : : // construct the rule itself
376 : : AF2Rule* rule =
377 : : new AF2Rule("Triangle Off Line, Quality Level 10", 10u, existVertices,
378 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
379 : :
380 : : // delete transforms that were allocated with new but cloned when
381 : : // made part of the rule definition
382 [ + - ]: 22 : delete halfBaseXTransform;
383 [ + - ]: 22 : delete baseXTransform;
384 [ + - ]: 22 : delete noTransform;
385 : :
386 : 22 : return rule;
387 : : }
388 : :
389 : 22 : const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ20() const
390 : : {
391 : : // define the vertices that must exist
392 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
393 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
394 : :
395 : : // assemble the vertices that must exist into a list
396 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
397 [ + - ]: 22 : existVertices.push_back(originExist);
398 [ + - ]: 22 : existVertices.push_back(baseExist);
399 : :
400 : : // define the baseline edge that must exist
401 : : const AF2RuleExistEdge* baseEdge =
402 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
403 : :
404 : : // define the other edges that must exist
405 : :
406 : : // assemble the non-baseline edges that must exist into a list
407 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
408 : :
409 : : // define the reference preferred boundary points of the free zone
410 : : // and assemble them into a list
411 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
412 : 22 : double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0};
413 : 22 : double prefYCoord[4] = {0.0, 0.0, 0.2, 0.2};
414 [ + + ]: 110 : for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi)
415 : : {
416 [ + - ]: 88 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
417 [ + - ]: 88 : prefBndryPnts.push_back(bndryPnt);
418 : : }
419 : :
420 : : // define the point transforms that apply to the preferred
421 : : // boundary points of the free zone and assemble them into a list
422 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
423 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
424 : : AF2PointTransform* baseXTransform =
425 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
426 : : AF2PointTransform* halfBaseXTransform =
427 [ + - ]: 22 : makeLinearTransformX(baseExist, 0.5);
428 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
429 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
430 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
431 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
432 : :
433 : : // define the reference limiting boundary points of the free zone
434 : : // and assemble them into a list
435 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
436 : 22 : double limXCoord[4] = {0.0, 1.0, 0.5, 0.5};
437 : 22 : double limYCoord[4] = {0.0, 0.0, 0.1, 0.1};
438 [ + + ]: 110 : for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi)
439 : : {
440 [ + - ]: 88 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
441 [ + - ]: 88 : limBndryPnts.push_back(bndryPnt);
442 : : }
443 : :
444 : : // define the point transforms that apply to the limiting
445 : : // boundary points of the free zone and assemble them into a list
446 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
447 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
448 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
449 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
450 [ + - ]: 22 : limBndryTrnsfrms.push_back(halfBaseXTransform);
451 : :
452 : : // define the free zone definition
453 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
454 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
455 : :
456 : : // define the new vertices that the rule would create and assemble them
457 : : // into a list
458 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
459 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.1);
460 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform));
[ + - ]
461 : :
462 : : // define the new edges and assemble them into a list
463 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
464 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
465 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
466 : :
467 : : // define the new triangles and assemble them into a list
468 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
469 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
470 : :
471 : : // construct the rule itself
472 : : AF2Rule* rule =
473 : : new AF2Rule("Triangle Off Line, Quality Level 20", 20u, existVertices,
474 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
475 : :
476 : : // delete transforms that were allocated with new but cloned when
477 : : // made part of the rule definition
478 [ + - ]: 22 : delete halfBaseXTransform;
479 [ + - ]: 22 : delete baseXTransform;
480 [ + - ]: 22 : delete noTransform;
481 : :
482 : 22 : return rule;
483 : : }
484 : :
485 : 22 : const AF2Rule* AF2DfltTriangleRules::make60DegreeAngleRightRule() const
486 : : {
487 : : // define the vertices that must exist
488 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
489 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
490 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866);
491 : :
492 : : // assemble the vertices that must exist into a list
493 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
494 [ + - ]: 22 : existVertices.push_back(originExist);
495 [ + - ]: 22 : existVertices.push_back(baseExist);
496 [ + - ]: 22 : existVertices.push_back(peakExist);
497 : :
498 : : // define the baseline edge that must exist
499 : : const AF2RuleExistEdge* baseEdge =
500 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
501 : :
502 : : // define the other edges that must exist and assemble them into a list
503 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
504 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(baseExist, peakExist));
[ + - ]
505 : :
506 : : // define a linear point transformation that balances the bound
507 : : // value of the base vertex and the peak vertex
508 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
509 [ + - ]: 44 : std::list<double> t0XCoeffList;
510 [ + - ]: 44 : std::list<double> t0YCoeffList;
511 : :
512 [ + - ]: 22 : t0VertexList.push_back(baseExist);
513 [ + - ]: 22 : t0VertexList.push_back(peakExist);
514 [ + - ]: 22 : t0XCoeffList.push_back(-0.5);
515 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
516 [ + - ]: 22 : t0XCoeffList.push_back(0.75);
517 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
518 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
519 [ + - ]: 22 : t0YCoeffList.push_back(-0.5);
520 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
521 [ + - ]: 22 : t0YCoeffList.push_back(0.75);
522 : :
523 : : AF2PointTransform* prefV3Transform =
524 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
525 : :
526 : : // define a linear point transformation that uses the bound
527 : : // value of the peak vertex, but has coefficients of 0.5 instead of 1.0
528 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
529 [ + - ]: 44 : std::list<double> t1XCoeffList;
530 [ + - ]: 44 : std::list<double> t1YCoeffList;
531 : :
532 [ + - ]: 22 : t1VertexList.push_back(peakExist);
533 [ + - ]: 22 : t1XCoeffList.push_back(0.5);
534 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
535 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
536 [ + - ]: 22 : t1YCoeffList.push_back(0.5);
537 : :
538 : : AF2PointTransform* limV3Transform =
539 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
540 : :
541 : : // define the reference preferred boundary points of the free zone
542 : : // and assemble them into a list
543 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
544 : 22 : double prefXCoord[4] = {0.0, 1.0, 0.5, -0.125};
545 : 22 : double prefYCoord[4] = {0.0, 0.0, 0.866, 0.6495};
546 [ + + ]: 110 : for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi)
547 : : {
548 [ + - ]: 88 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
549 [ + - ]: 88 : prefBndryPnts.push_back(bndryPnt);
550 : : }
551 : :
552 : : // define the point transforms that apply to the preferred
553 : : // boundary points of the free zone and assemble them into a list
554 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
555 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
556 : : AF2PointTransform* baseXTransform =
557 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
558 [ + - ]: 22 : AF2PointTransform* translateToPeak = makeTranslation(peakExist);
559 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
560 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
561 [ + - ]: 22 : prefBndryTrnsfrms.push_back(translateToPeak);
562 [ + - ]: 22 : prefBndryTrnsfrms.push_back(prefV3Transform);
563 : :
564 : : // define the reference limiting boundary points of the free zone
565 : : // and assemble them into a list
566 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
567 : 22 : double limXCoord[4] = {0.0, 1.0, 0.5, 0.25};
568 : 22 : double limYCoord[4] = {0.0, 0.0, 0.866, 0.433};
569 [ + + ]: 110 : for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi)
570 : : {
571 [ + - ]: 88 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
572 [ + - ]: 88 : limBndryPnts.push_back(bndryPnt);
573 : : }
574 : :
575 : : // define the point transforms that apply to the limiting
576 : : // boundary points of the free zone and assemble them into a list
577 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
578 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
579 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
580 [ + - ]: 22 : limBndryTrnsfrms.push_back(translateToPeak);
581 [ + - ]: 22 : limBndryTrnsfrms.push_back(limV3Transform);
582 : :
583 : : // define the free zone definition
584 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
585 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
586 : :
587 : : // define the new vertices that the rule would create and assemble them
588 : : // into a list
589 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
590 : :
591 : : // define the new edges and assemble them into a list
592 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
593 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
594 : :
595 : : // define the new triangles and assemble them into a list
596 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
597 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
598 : :
599 : : // construct the rule itself
600 : : AF2Rule* rule =
601 : : new AF2Rule("Angle at Right Vertex of 60 Degrees", 1u, existVertices,
602 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
603 : :
604 : : // delete transforms that were allocated with new but cloned when
605 : : // made part of the rule definition
606 [ + - ]: 22 : delete translateToPeak;
607 [ + - ]: 22 : delete baseXTransform;
608 [ + - ]: 22 : delete noTransform;
609 [ + - ]: 22 : delete limV3Transform;
610 [ + - ]: 22 : delete prefV3Transform;
611 : :
612 : 22 : return rule;
613 : : }
614 : :
615 : 22 : const AF2Rule* AF2DfltTriangleRules::make60DegreeAngleLeftRule() const
616 : : {
617 : : // define the vertices that must exist
618 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
619 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
620 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866);
621 : :
622 : : // assemble the vertices that must exist into a list
623 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
624 [ + - ]: 22 : existVertices.push_back(originExist);
625 [ + - ]: 22 : existVertices.push_back(baseExist);
626 [ + - ]: 22 : existVertices.push_back(peakExist);
627 : :
628 : : // define the baseline edge that must exist
629 : : const AF2RuleExistEdge* baseEdge =
630 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
631 : :
632 : : // define the other edges that must exist and assemble them into a list
633 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
634 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(peakExist, originExist));
[ + - ]
635 : :
636 : : // define a linear point transformation that balances the bound
637 : : // value of the base vertex and the peak vertex
638 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
639 [ + - ]: 44 : std::list<double> t0XCoeffList;
640 [ + - ]: 44 : std::list<double> t0YCoeffList;
641 : :
642 [ + - ]: 22 : t0VertexList.push_back(baseExist);
643 [ + - ]: 22 : t0VertexList.push_back(peakExist);
644 [ + - ]: 22 : t0XCoeffList.push_back(0.75);
645 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
646 [ + - ]: 22 : t0XCoeffList.push_back(0.75);
647 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
648 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
649 [ + - ]: 22 : t0YCoeffList.push_back(0.75);
650 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
651 [ + - ]: 22 : t0YCoeffList.push_back(0.75);
652 : :
653 : : AF2PointTransform* prefV2Transform =
654 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
655 : :
656 : : // define a linear point transformation that translates by the difference
657 : : // between the bound value and reference value of the midpoint
658 : : // between the base vertex and peak vertex
659 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
660 [ + - ]: 44 : std::list<double> t1XCoeffList;
661 [ + - ]: 44 : std::list<double> t1YCoeffList;
662 : :
663 [ + - ]: 22 : t1VertexList.push_back(baseExist);
664 [ + - ]: 22 : t1VertexList.push_back(peakExist);
665 [ + - ]: 22 : t1XCoeffList.push_back(0.5);
666 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
667 [ + - ]: 22 : t1XCoeffList.push_back(0.5);
668 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
669 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
670 [ + - ]: 22 : t1YCoeffList.push_back(0.5);
671 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
672 [ + - ]: 22 : t1YCoeffList.push_back(0.5);
673 : :
674 : : AF2PointTransform* limV2Transform =
675 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
676 : :
677 : : // define the reference preferred boundary points of the free zone
678 : : // and assemble them into a list
679 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
680 : 22 : double prefXCoord[4] = {0.0, 1.0, 1.125, 0.5};
681 : 22 : double prefYCoord[4] = {0.0, 0.0, 0.6495, 0.866};
682 [ + + ]: 110 : for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi)
683 : : {
684 [ + - ]: 88 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
685 [ + - ]: 88 : prefBndryPnts.push_back(bndryPnt);
686 : : }
687 : :
688 : : // define the point transforms that apply to the preferred
689 : : // boundary points of the free zone and assemble them into a list
690 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
691 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
692 : : AF2PointTransform* baseXTransform =
693 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
694 [ + - ]: 22 : AF2PointTransform* translateToPeak = makeTranslation(peakExist);
695 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
696 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseXTransform);
697 [ + - ]: 22 : prefBndryTrnsfrms.push_back(prefV2Transform);
698 [ + - ]: 22 : prefBndryTrnsfrms.push_back(translateToPeak);
699 : :
700 : : // define the reference limiting boundary points of the free zone
701 : : // and assemble them into a list
702 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
703 : 22 : double limXCoord[4] = {0.0, 1.0, 0.75, 0.5};
704 : 22 : double limYCoord[4] = {0.0, 0.0, 0.433, 0.866};
705 [ + + ]: 110 : for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi)
706 : : {
707 [ + - ]: 88 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
708 [ + - ]: 88 : limBndryPnts.push_back(bndryPnt);
709 : : }
710 : :
711 : : // define the point transforms that apply to the limiting
712 : : // boundary points of the free zone and assemble them into a list
713 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
714 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
715 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseXTransform);
716 [ + - ]: 22 : limBndryTrnsfrms.push_back(limV2Transform);
717 [ + - ]: 22 : limBndryTrnsfrms.push_back(translateToPeak);
718 : :
719 : : // define the free zone definition
720 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
721 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
722 : :
723 : : // define the new vertices that the rule would create and assemble them
724 : : // into a list
725 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
726 : :
727 : : // define the new edges and assemble them into a list
728 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
729 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
730 : :
731 : : // define the new triangles and assemble them into a list
732 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
733 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
734 : :
735 : : // construct the rule itself
736 : : AF2Rule* rule =
737 : : new AF2Rule("Angle at Left Vertex of 60 Degrees", 1u, existVertices,
738 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
739 : :
740 : : // delete transforms that were allocated with new but cloned when
741 : : // made part of the rule definition
742 [ + - ]: 22 : delete translateToPeak;
743 [ + - ]: 22 : delete baseXTransform;
744 [ + - ]: 22 : delete noTransform;
745 [ + - ]: 22 : delete limV2Transform;
746 [ + - ]: 22 : delete prefV2Transform;
747 : :
748 : 22 : return rule;
749 : : }
750 : :
751 : 22 : const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleRightRule() const
752 : : {
753 : : // define the vertices that must exist
754 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
755 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
756 : : const AF2RuleExistVertex* highRightExist =
757 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(1.5, 0.866);
758 : :
759 : : // assemble the vertices that must exist into a list
760 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
761 [ + - ]: 22 : existVertices.push_back(originExist);
762 [ + - ]: 22 : existVertices.push_back(baseExist);
763 [ + - ]: 22 : existVertices.push_back(highRightExist);
764 : :
765 : : // define the baseline edge that must exist
766 : : const AF2RuleExistEdge* baseEdge =
767 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
768 : :
769 : : // define the other edges that must exist and assemble them into a list
770 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
771 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(baseExist, highRightExist));
[ + - ]
772 : :
773 : : // define a linear point transformation that depends on
774 : : // the base vertex and highRight vertex
775 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
776 [ + - ]: 44 : std::list<double> t0XCoeffList;
777 [ + - ]: 44 : std::list<double> t0YCoeffList;
778 : :
779 [ + - ]: 22 : t0VertexList.push_back(baseExist);
780 [ + - ]: 22 : t0VertexList.push_back(highRightExist);
781 [ + - ]: 22 : t0XCoeffList.push_back(-1.0);
782 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
783 [ + - ]: 22 : t0XCoeffList.push_back(1.0);
784 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
785 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
786 [ + - ]: 22 : t0YCoeffList.push_back(-1.0);
787 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
788 [ + - ]: 22 : t0YCoeffList.push_back(1.0);
789 : :
790 : : AF2PointTransform* newVertexTransform =
791 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
792 : :
793 : : // define another linear point transformation that depends on
794 : : // the base vertex and highRight vertex
795 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
796 [ + - ]: 44 : std::list<double> t1XCoeffList;
797 [ + - ]: 44 : std::list<double> t1YCoeffList;
798 : :
799 [ + - ]: 22 : t1VertexList.push_back(baseExist);
800 [ + - ]: 22 : t1VertexList.push_back(highRightExist);
801 [ + - ]: 22 : t1XCoeffList.push_back(-2.0);
802 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
803 [ + - ]: 22 : t1XCoeffList.push_back(2.0);
804 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
805 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
806 [ + - ]: 22 : t1YCoeffList.push_back(-2.0);
807 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
808 [ + - ]: 22 : t1YCoeffList.push_back(2.0);
809 : :
810 : : AF2PointTransform* fzV3Transform =
811 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
812 : :
813 : : // define a third linear point transformation that depends on
814 : : // the base vertex and highRight vertex
815 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t2VertexList;
816 [ + - ]: 44 : std::list<double> t2XCoeffList;
817 [ + - ]: 44 : std::list<double> t2YCoeffList;
818 : :
819 [ + - ]: 22 : t2VertexList.push_back(baseExist);
820 [ + - ]: 22 : t2VertexList.push_back(highRightExist);
821 [ + - ]: 22 : t2XCoeffList.push_back(-3.0);
822 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
823 [ + - ]: 22 : t2XCoeffList.push_back(2.0);
824 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
825 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
826 [ + - ]: 22 : t2YCoeffList.push_back(-3.0);
827 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
828 [ + - ]: 22 : t2YCoeffList.push_back(2.0);
829 : :
830 : : AF2PointTransform* fzV4Transform =
831 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList);
[ + - ][ + - ]
[ + - ]
832 : :
833 : : // define a fourth linear point transformation that depends on
834 : : // the base vertex and highRight vertex
835 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t3VertexList;
836 [ + - ]: 44 : std::list<double> t3XCoeffList;
837 [ + - ]: 44 : std::list<double> t3YCoeffList;
838 : :
839 [ + - ]: 22 : t3VertexList.push_back(baseExist);
840 [ + - ]: 22 : t3VertexList.push_back(highRightExist);
841 [ + - ]: 22 : t3XCoeffList.push_back(-2.0);
842 [ + - ]: 22 : t3XCoeffList.push_back(0.0);
843 [ + - ]: 22 : t3XCoeffList.push_back(1.0);
844 [ + - ]: 22 : t3XCoeffList.push_back(0.0);
845 [ + - ]: 22 : t3YCoeffList.push_back(0.0);
846 [ + - ]: 22 : t3YCoeffList.push_back(-2.0);
847 [ + - ]: 22 : t3YCoeffList.push_back(0.0);
848 [ + - ]: 22 : t3YCoeffList.push_back(1.0);
849 : :
850 : : AF2PointTransform* fzV5Transform =
851 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList);
[ + - ][ + - ]
[ + - ]
852 : :
853 : : // define the reference boundary points of the free zone
854 : : // and assemble them into a list
855 [ + - ]: 44 : std::list<AF2Point2D> fzBndryPnts;
856 : 22 : double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5};
857 : 22 : double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866};
858 [ + + ]: 154 : for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi)
859 : : {
860 [ + - ]: 132 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
861 [ + - ]: 132 : fzBndryPnts.push_back(bndryPnt);
862 : : }
863 : :
864 : : // define the point transforms that apply to the boundary points
865 : : // of the free zone and assemble them into a list
866 [ + - ]: 44 : std::list<const AF2PointTransform*> fzBndryTrnsfrms;
867 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
868 : : AF2PointTransform* baseXTransform =
869 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
870 [ + - ]: 22 : AF2PointTransform* translateToHighRight = makeTranslation(highRightExist);
871 [ + - ]: 22 : fzBndryTrnsfrms.push_back(noTransform);
872 [ + - ]: 22 : fzBndryTrnsfrms.push_back(baseXTransform);
873 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToHighRight);
874 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV3Transform);
875 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV4Transform);
876 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV5Transform);
877 : :
878 : : // define the free zone definition
879 : : AF2FreeZoneDef* freeZoneDef =
880 [ + - ][ + - ]: 22 : new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms);
881 : :
882 : : // define the new vertices that the rule would create and assemble them
883 : : // into a list
884 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
885 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.866);
886 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform));
[ + - ]
887 : :
888 : : // define the new edges and assemble them into a list
889 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
890 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 3));
[ + - ]
891 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(3, 2));
[ + - ]
892 : :
893 : : // define the new triangles and assemble them into a list
894 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
895 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 3));
[ + - ]
896 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(1, 2, 3));
[ + - ]
897 : :
898 : : // construct the rule itself
899 : : AF2Rule* rule =
900 : : new AF2Rule("Angle at Right Vertex of 120 Degrees", 1u, existVertices,
901 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
902 : :
903 : : // delete transforms that were allocated with new but cloned when
904 : : // made part of the rule definition
905 [ + - ]: 22 : delete translateToHighRight;
906 [ + - ]: 22 : delete baseXTransform;
907 [ + - ]: 22 : delete noTransform;
908 [ + - ]: 22 : delete fzV5Transform;
909 [ + - ]: 22 : delete fzV4Transform;
910 [ + - ]: 22 : delete fzV3Transform;
911 [ + - ]: 22 : delete newVertexTransform;
912 : :
913 : 22 : return rule;
914 : : }
915 : :
916 : 22 : const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleLeftRule() const
917 : : {
918 : : // define the vertices that must exist
919 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
920 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
921 : : const AF2RuleExistVertex* highLeftExist =
922 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(-0.5, 0.866);
923 : :
924 : : // assemble the vertices that must exist into a list
925 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
926 [ + - ]: 22 : existVertices.push_back(originExist);
927 [ + - ]: 22 : existVertices.push_back(baseExist);
928 [ + - ]: 22 : existVertices.push_back(highLeftExist);
929 : :
930 : : // define the baseline edge that must exist
931 : : const AF2RuleExistEdge* baseEdge =
932 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
933 : :
934 : : // define the other edges that must exist and assemble them into a list
935 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
936 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(highLeftExist, originExist));
[ + - ]
937 : :
938 : : // define a linear point transformation that depends on
939 : : // the base vertex and highLeft vertex
940 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
941 [ + - ]: 44 : std::list<double> t0XCoeffList;
942 [ + - ]: 44 : std::list<double> t0YCoeffList;
943 : :
944 [ + - ]: 22 : t0VertexList.push_back(baseExist);
945 [ + - ]: 22 : t0VertexList.push_back(highLeftExist);
946 [ + - ]: 22 : t0XCoeffList.push_back(1.0);
947 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
948 [ + - ]: 22 : t0XCoeffList.push_back(1.0);
949 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
950 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
951 [ + - ]: 22 : t0YCoeffList.push_back(1.0);
952 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
953 [ + - ]: 22 : t0YCoeffList.push_back(1.0);
954 : :
955 : : AF2PointTransform* newVertexTransform =
956 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
957 : :
958 : : // define another linear point transformation that depends on
959 : : // the base vertex and highLeft vertex
960 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
961 [ + - ]: 44 : std::list<double> t1XCoeffList;
962 [ + - ]: 44 : std::list<double> t1YCoeffList;
963 : :
964 [ + - ]: 22 : t1VertexList.push_back(baseExist);
965 [ + - ]: 22 : t1VertexList.push_back(highLeftExist);
966 [ + - ]: 22 : t1XCoeffList.push_back(2.0);
967 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
968 [ + - ]: 22 : t1XCoeffList.push_back(1.0);
969 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
970 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
971 [ + - ]: 22 : t1YCoeffList.push_back(2.0);
972 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
973 [ + - ]: 22 : t1YCoeffList.push_back(1.0);
974 : :
975 : : AF2PointTransform* fzV2Transform =
976 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
977 : :
978 : : // define a third linear point transformation that depends on
979 : : // the base vertex and highLeft vertex
980 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t2VertexList;
981 [ + - ]: 44 : std::list<double> t2XCoeffList;
982 [ + - ]: 44 : std::list<double> t2YCoeffList;
983 : :
984 [ + - ]: 22 : t2VertexList.push_back(baseExist);
985 [ + - ]: 22 : t2VertexList.push_back(highLeftExist);
986 [ + - ]: 22 : t2XCoeffList.push_back(2.0);
987 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
988 [ + - ]: 22 : t2XCoeffList.push_back(2.0);
989 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
990 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
991 [ + - ]: 22 : t2YCoeffList.push_back(2.0);
992 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
993 [ + - ]: 22 : t2YCoeffList.push_back(2.0);
994 : :
995 : : AF2PointTransform* fzV3Transform =
996 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList);
[ + - ][ + - ]
[ + - ]
997 : :
998 : : // define a fourth linear point transformation that depends on
999 : : // the base vertex and highLeft vertex
1000 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t3VertexList;
1001 [ + - ]: 44 : std::list<double> t3XCoeffList;
1002 [ + - ]: 44 : std::list<double> t3YCoeffList;
1003 : :
1004 [ + - ]: 22 : t3VertexList.push_back(baseExist);
1005 [ + - ]: 22 : t3VertexList.push_back(highLeftExist);
1006 [ + - ]: 22 : t3XCoeffList.push_back(1.0);
1007 [ + - ]: 22 : t3XCoeffList.push_back(0.0);
1008 [ + - ]: 22 : t3XCoeffList.push_back(2.0);
1009 [ + - ]: 22 : t3XCoeffList.push_back(0.0);
1010 [ + - ]: 22 : t3YCoeffList.push_back(0.0);
1011 [ + - ]: 22 : t3YCoeffList.push_back(1.0);
1012 [ + - ]: 22 : t3YCoeffList.push_back(0.0);
1013 [ + - ]: 22 : t3YCoeffList.push_back(2.0);
1014 : :
1015 : : AF2PointTransform* fzV4Transform =
1016 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList);
[ + - ][ + - ]
[ + - ]
1017 : :
1018 : : // define the reference boundary points of the free zone
1019 : : // and assemble them into a list
1020 [ + - ]: 44 : std::list<AF2Point2D> fzBndryPnts;
1021 : 22 : double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5};
1022 : 22 : double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866};
1023 [ + + ]: 154 : for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi)
1024 : : {
1025 [ + - ]: 132 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
1026 [ + - ]: 132 : fzBndryPnts.push_back(bndryPnt);
1027 : : }
1028 : :
1029 : : // define the point transforms that apply to the boundary points
1030 : : // of the free zone and assemble them into a list
1031 [ + - ]: 44 : std::list<const AF2PointTransform*> fzBndryTrnsfrms;
1032 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
1033 : : AF2PointTransform* baseXTransform =
1034 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
1035 [ + - ]: 22 : AF2PointTransform* translateToHighLeft = makeTranslation(highLeftExist);
1036 [ + - ]: 22 : fzBndryTrnsfrms.push_back(noTransform);
1037 [ + - ]: 22 : fzBndryTrnsfrms.push_back(baseXTransform);
1038 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV2Transform);
1039 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV3Transform);
1040 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV4Transform);
1041 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToHighLeft);
1042 : :
1043 : : // define the free zone definition
1044 : : AF2FreeZoneDef* freeZoneDef =
1045 [ + - ][ + - ]: 22 : new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms);
1046 : :
1047 : : // define the new vertices that the rule would create and assemble them
1048 : : // into a list
1049 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
1050 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.866);
1051 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform));
[ + - ]
1052 : :
1053 : : // define the new edges and assemble them into a list
1054 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
1055 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 3));
[ + - ]
1056 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(3, 1));
[ + - ]
1057 : :
1058 : : // define the new triangles and assemble them into a list
1059 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
1060 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 3));
[ + - ]
1061 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 3, 2));
[ + - ]
1062 : :
1063 : : // construct the rule itself
1064 : : AF2Rule* rule =
1065 : : new AF2Rule("Angle at Left Vertex of 120 Degrees", 1u, existVertices,
1066 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
1067 : :
1068 : : // delete transforms that were allocated with new but cloned when
1069 : : // made part of the rule definition
1070 [ + - ]: 22 : delete translateToHighLeft;
1071 [ + - ]: 22 : delete baseXTransform;
1072 [ + - ]: 22 : delete noTransform;
1073 [ + - ]: 22 : delete fzV4Transform;
1074 [ + - ]: 22 : delete fzV3Transform;
1075 [ + - ]: 22 : delete fzV2Transform;
1076 [ + - ]: 22 : delete newVertexTransform;
1077 : :
1078 : 22 : return rule;
1079 : : }
1080 : :
1081 : 22 : const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleBothRule() const
1082 : : {
1083 : : // define the vertices that must exist
1084 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
1085 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
1086 : : const AF2RuleExistVertex* highLeftExist =
1087 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(-0.5, 0.866);
1088 : : const AF2RuleExistVertex* highRightExist =
1089 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(1.5, 0.866);
1090 : :
1091 : : // assemble the vertices that must exist into a list
1092 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
1093 [ + - ]: 22 : existVertices.push_back(originExist);
1094 [ + - ]: 22 : existVertices.push_back(baseExist);
1095 [ + - ]: 22 : existVertices.push_back(highLeftExist);
1096 [ + - ]: 22 : existVertices.push_back(highRightExist);
1097 : :
1098 : : // define the baseline edge that must exist
1099 : : const AF2RuleExistEdge* baseEdge =
1100 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
1101 : :
1102 : : // define the other edges that must exist and assemble them into a list
1103 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
1104 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(highLeftExist, originExist));
[ + - ]
1105 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(baseExist, highRightExist));
[ + - ]
1106 : :
1107 : : // define a linear point transformation that translates along the vector
1108 : : // from the reference location to the bound value location of the
1109 : : // midpoint between the highLeft and highRight vertices
1110 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
1111 [ + - ]: 44 : std::list<double> t0XCoeffList;
1112 [ + - ]: 44 : std::list<double> t0YCoeffList;
1113 : :
1114 [ + - ]: 22 : t0VertexList.push_back(highLeftExist);
1115 [ + - ]: 22 : t0VertexList.push_back(highRightExist);
1116 [ + - ]: 22 : t0XCoeffList.push_back(0.5);
1117 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1118 [ + - ]: 22 : t0XCoeffList.push_back(0.5);
1119 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1120 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1121 [ + - ]: 22 : t0YCoeffList.push_back(0.5);
1122 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1123 [ + - ]: 22 : t0YCoeffList.push_back(0.5);
1124 : :
1125 : : AF2PointTransform* newVertexTransform =
1126 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
1127 : :
1128 : : // define a linear point transformation that depends on
1129 : : // the base vertex, the highLeft vertex, and the highRight vertex
1130 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
1131 [ + - ]: 44 : std::list<double> t1XCoeffList;
1132 [ + - ]: 44 : std::list<double> t1YCoeffList;
1133 : :
1134 [ + - ]: 22 : t1VertexList.push_back(baseExist);
1135 [ + - ]: 22 : t1VertexList.push_back(highLeftExist);
1136 [ + - ]: 22 : t1VertexList.push_back(highRightExist);
1137 [ + - ]: 22 : t1XCoeffList.push_back(-0.5);
1138 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1139 [ + - ]: 22 : t1XCoeffList.push_back(0.375);
1140 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1141 [ + - ]: 22 : t1XCoeffList.push_back(1.125);
1142 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1143 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1144 [ + - ]: 22 : t1YCoeffList.push_back(-0.5);
1145 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1146 [ + - ]: 22 : t1YCoeffList.push_back(0.375);
1147 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1148 [ + - ]: 22 : t1YCoeffList.push_back(1.125);
1149 : :
1150 : : AF2PointTransform* fzV3Transform =
1151 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
1152 : :
1153 : : // define a linear point transformation that depends on only
1154 : : // the highLeft vertex and the highRight vertex
1155 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t2VertexList;
1156 [ + - ]: 44 : std::list<double> t2XCoeffList;
1157 [ + - ]: 44 : std::list<double> t2YCoeffList;
1158 : :
1159 [ + - ]: 22 : t2VertexList.push_back(highLeftExist);
1160 [ + - ]: 22 : t2VertexList.push_back(highRightExist);
1161 [ + - ]: 22 : t2XCoeffList.push_back(1.125);
1162 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1163 [ + - ]: 22 : t2XCoeffList.push_back(0.375);
1164 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1165 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1166 [ + - ]: 22 : t2YCoeffList.push_back(1.125);
1167 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1168 [ + - ]: 22 : t2YCoeffList.push_back(0.375);
1169 : :
1170 : : AF2PointTransform* fzV4Transform =
1171 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList);
[ + - ][ + - ]
[ + - ]
1172 : :
1173 : : // define the reference boundary points of the free zone
1174 : : // and assemble them into a list
1175 [ + - ]: 44 : std::list<AF2Point2D> fzBndryPnts;
1176 : 22 : double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5};
1177 : 22 : double prefYCoord[6] = {0.0, 0.0, 0.866, 1.299, 1.299, 0.866};
1178 [ + + ]: 154 : for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi)
1179 : : {
1180 [ + - ]: 132 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
1181 [ + - ]: 132 : fzBndryPnts.push_back(bndryPnt);
1182 : : }
1183 : :
1184 : : // define the point transforms that apply to the boundary points
1185 : : // of the free zone and assemble them into a list
1186 [ + - ]: 44 : std::list<const AF2PointTransform*> fzBndryTrnsfrms;
1187 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
1188 : : AF2PointTransform* baseXTransform =
1189 [ + - ]: 22 : makeLinearTransformX(baseExist, 1.0);
1190 [ + - ]: 22 : AF2PointTransform* translateToHighRight = makeTranslation(highRightExist);
1191 [ + - ]: 22 : AF2PointTransform* translateToHighLeft = makeTranslation(highLeftExist);
1192 [ + - ]: 22 : fzBndryTrnsfrms.push_back(noTransform);
1193 [ + - ]: 22 : fzBndryTrnsfrms.push_back(baseXTransform);
1194 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToHighRight);
1195 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV3Transform);
1196 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV4Transform);
1197 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToHighLeft);
1198 : :
1199 : : // define the free zone definition
1200 : : AF2FreeZoneDef* freeZoneDef =
1201 [ + - ][ + - ]: 22 : new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms);
1202 : :
1203 : : // define the new vertices that the rule would create and assemble them
1204 : : // into a list
1205 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
1206 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.866);
1207 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform));
[ + - ]
1208 : :
1209 : : // define the new edges and assemble them into a list
1210 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
1211 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 4));
[ + - ]
1212 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(4, 3));
[ + - ]
1213 : :
1214 : : // define the new triangles and assemble them into a list
1215 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
1216 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 4));
[ + - ]
1217 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 4, 2));
[ + - ]
1218 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(1, 3, 4));
[ + - ]
1219 : :
1220 : : // construct the rule itself
1221 : : AF2Rule* rule =
1222 : : new AF2Rule("Angles at Both Vertices of 120 Degrees", 1u, existVertices,
1223 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
1224 : :
1225 : : // delete transforms that were allocated with new but cloned when
1226 : : // made part of the rule definition
1227 [ + - ]: 22 : delete translateToHighLeft;
1228 [ + - ]: 22 : delete translateToHighRight;
1229 [ + - ]: 22 : delete baseXTransform;
1230 [ + - ]: 22 : delete noTransform;
1231 [ + - ]: 22 : delete fzV4Transform;
1232 [ + - ]: 22 : delete fzV3Transform;
1233 [ + - ]: 22 : delete newVertexTransform;
1234 : :
1235 : 22 : return rule;
1236 : : }
1237 : :
1238 : 22 : const AF2Rule* AF2DfltTriangleRules::makeFillTriangleRule() const
1239 : : {
1240 : : // define the vertices that must exist
1241 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
1242 : : const AF2RuleExistVertex* baseExist =
1243 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(1.0, 0.0, 0.5, 0.0, 0.5);
1244 : : const AF2RuleExistVertex* peakExist =
1245 [ + - ][ + - ]: 22 : new AF2RuleExistVertex(0.5, 0.866, 0.25, 0.0, 0.25);
1246 : :
1247 : : // assemble the vertices that must exist into a list
1248 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
1249 [ + - ]: 22 : existVertices.push_back(originExist);
1250 [ + - ]: 22 : existVertices.push_back(baseExist);
1251 [ + - ]: 22 : existVertices.push_back(peakExist);
1252 : :
1253 : : // define the baseline edge that must exist
1254 : : const AF2RuleExistEdge* baseEdge =
1255 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
1256 : :
1257 : : // define the other edges that must exist and assemble them into a list
1258 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
1259 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(baseExist, peakExist));
[ + - ]
1260 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(peakExist, originExist));
[ + - ]
1261 : :
1262 : : // define the reference boundary points of the free zone
1263 : : // and assemble them into a list
1264 [ + - ]: 44 : std::list<AF2Point2D> fzBndryPnts;
1265 : 22 : double prefXCoord[3] = {0.0, 1.0, 0.5};
1266 : 22 : double prefYCoord[3] = {0.0, 0.0, 0.866};
1267 [ + + ]: 88 : for (unsigned int pbpi = 0u; pbpi < 3u; ++pbpi)
1268 : : {
1269 [ + - ]: 66 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
1270 [ + - ]: 66 : fzBndryPnts.push_back(bndryPnt);
1271 : : }
1272 : :
1273 : : // define the point transforms that apply to the boundary points
1274 : : // of the free zone and assemble them into a list
1275 [ + - ]: 44 : std::list<const AF2PointTransform*> fzBndryTrnsfrms;
1276 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
1277 [ + - ]: 22 : AF2PointTransform* baseTransform = makeTranslation(baseExist);
1278 [ + - ]: 22 : AF2PointTransform* translateToPeak = makeTranslation(peakExist);
1279 [ + - ]: 22 : fzBndryTrnsfrms.push_back(noTransform);
1280 [ + - ]: 22 : fzBndryTrnsfrms.push_back(baseTransform);
1281 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToPeak);
1282 : :
1283 : : // define the free zone definition
1284 : : AF2FreeZoneDef* freeZoneDef =
1285 [ + - ][ + - ]: 22 : new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms);
1286 : :
1287 : : // define the new vertices that the rule would create and assemble them
1288 : : // into a list
1289 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
1290 : :
1291 : : // define the new edges and assemble them into a list
1292 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
1293 : :
1294 : : // define the new triangles and assemble them into a list
1295 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
1296 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
1297 : :
1298 : : // construct the rule itself
1299 : : AF2Rule* rule =
1300 : : new AF2Rule("Fill Triangle", 1u, existVertices,
1301 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
1302 : :
1303 : : // delete transforms that were allocated with new but cloned when
1304 : : // made part of the rule definition
1305 [ + - ]: 22 : delete translateToPeak;
1306 [ + - ]: 22 : delete baseTransform;
1307 [ + - ]: 22 : delete noTransform;
1308 : :
1309 : 22 : return rule;
1310 : : }
1311 : :
1312 : 22 : const AF2Rule* AF2DfltTriangleRules::makeConnectVertexRule() const
1313 : : {
1314 : : // define the vertices that must exist
1315 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
1316 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
1317 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866);
1318 : :
1319 : : // assemble the vertices that must exist into a list
1320 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
1321 [ + - ]: 22 : existVertices.push_back(originExist);
1322 [ + - ]: 22 : existVertices.push_back(baseExist);
1323 [ + - ]: 22 : existVertices.push_back(peakExist);
1324 : :
1325 : : // define the baseline edge that must exist
1326 : : const AF2RuleExistEdge* baseEdge =
1327 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
1328 : :
1329 : : // define the other edges that must exist and assemble them into a list
1330 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
1331 : :
1332 : : // define a linear point transformation that balances the bound
1333 : : // value of the base vertex and the peak vertex
1334 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
1335 [ + - ]: 44 : std::list<double> t0XCoeffList;
1336 [ + - ]: 44 : std::list<double> t0YCoeffList;
1337 : :
1338 [ + - ]: 22 : t0VertexList.push_back(baseExist);
1339 [ + - ]: 22 : t0VertexList.push_back(peakExist);
1340 [ + - ]: 22 : t0XCoeffList.push_back(0.8);
1341 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1342 [ + - ]: 22 : t0XCoeffList.push_back(0.8);
1343 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1344 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1345 [ + - ]: 22 : t0YCoeffList.push_back(0.8);
1346 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1347 [ + - ]: 22 : t0YCoeffList.push_back(0.8);
1348 : :
1349 : : AF2PointTransform* prefV2Transform =
1350 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
1351 : :
1352 : : // define another linear point transformation that balances the bound
1353 : : // value of the base vertex and the peak vertex
1354 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
1355 [ + - ]: 44 : std::list<double> t1XCoeffList;
1356 [ + - ]: 44 : std::list<double> t1YCoeffList;
1357 : :
1358 [ + - ]: 22 : t1VertexList.push_back(baseExist);
1359 [ + - ]: 22 : t1VertexList.push_back(peakExist);
1360 [ + - ]: 22 : t1XCoeffList.push_back(-0.6);
1361 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1362 [ + - ]: 22 : t1XCoeffList.push_back(0.8);
1363 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1364 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1365 [ + - ]: 22 : t1YCoeffList.push_back(-0.6);
1366 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1367 [ + - ]: 22 : t1YCoeffList.push_back(0.8);
1368 : :
1369 : : AF2PointTransform* prefV4Transform =
1370 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
1371 : :
1372 : : // define a linear point transformation that translates along a
1373 : : // vector from the reference location to the bound value location
1374 : : // of the midpoint between the base vertex and peak vertex
1375 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t2VertexList;
1376 [ + - ]: 44 : std::list<double> t2XCoeffList;
1377 [ + - ]: 44 : std::list<double> t2YCoeffList;
1378 : :
1379 [ + - ]: 22 : t2VertexList.push_back(baseExist);
1380 [ + - ]: 22 : t2VertexList.push_back(peakExist);
1381 [ + - ]: 22 : t2XCoeffList.push_back(0.5);
1382 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1383 [ + - ]: 22 : t2XCoeffList.push_back(0.5);
1384 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1385 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1386 [ + - ]: 22 : t2YCoeffList.push_back(0.5);
1387 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1388 [ + - ]: 22 : t2YCoeffList.push_back(0.5);
1389 : :
1390 : : AF2PointTransform* limV2Transform =
1391 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList);
[ + - ][ + - ]
[ + - ]
1392 : :
1393 : : // define a linear point transformation that translates along a
1394 : : // vector from the reference location to the bound value location
1395 : : // of the midpoint between the origin vertex and peak vertex
1396 : : // (assuming the origin vertex is bound at (0, 0))
1397 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t3VertexList;
1398 [ + - ]: 44 : std::list<double> t3XCoeffList;
1399 [ + - ]: 44 : std::list<double> t3YCoeffList;
1400 : :
1401 [ + - ]: 22 : t3VertexList.push_back(peakExist);
1402 [ + - ]: 22 : t3XCoeffList.push_back(0.5);
1403 [ + - ]: 22 : t3XCoeffList.push_back(0.0);
1404 [ + - ]: 22 : t3YCoeffList.push_back(0.0);
1405 [ + - ]: 22 : t3YCoeffList.push_back(0.5);
1406 : :
1407 : : AF2PointTransform* limV4Transform =
1408 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList);
[ + - ][ + - ]
[ + - ]
1409 : :
1410 : : // define the reference preferred boundary points of the free zone
1411 : : // and assemble them into a list
1412 [ + - ]: 44 : std::list<AF2Point2D> prefBndryPnts;
1413 : 22 : double prefXCoord[5] = {0.0, 1.0, 1.2, 0.5, -0.2};
1414 : 22 : double prefYCoord[5] = {0.0, 0.0, 0.693, 0.866, 0.693};
1415 [ + + ]: 132 : for (unsigned int pbpi = 0u; pbpi < 5u; ++pbpi)
1416 : : {
1417 [ + - ]: 110 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
1418 [ + - ]: 110 : prefBndryPnts.push_back(bndryPnt);
1419 : : }
1420 : :
1421 : : // define the point transforms that apply to the preferred
1422 : : // boundary points of the free zone and assemble them into a list
1423 [ + - ]: 44 : std::list<const AF2PointTransform*> prefBndryTrnsfrms;
1424 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
1425 [ + - ]: 22 : AF2PointTransform* baseTransform = makeTranslation(baseExist);
1426 [ + - ]: 22 : AF2PointTransform* translateToPeak = makeTranslation(peakExist);
1427 [ + - ]: 22 : prefBndryTrnsfrms.push_back(noTransform);
1428 [ + - ]: 22 : prefBndryTrnsfrms.push_back(baseTransform);
1429 [ + - ]: 22 : prefBndryTrnsfrms.push_back(prefV2Transform);
1430 [ + - ]: 22 : prefBndryTrnsfrms.push_back(translateToPeak);
1431 [ + - ]: 22 : prefBndryTrnsfrms.push_back(prefV4Transform);
1432 : :
1433 : : // define the reference limiting boundary points of the free zone
1434 : : // and assemble them into a list
1435 [ + - ]: 44 : std::list<AF2Point2D> limBndryPnts;
1436 : 22 : double limXCoord[5] = {0.0, 1.0, 0.75, 0.5, 0.25};
1437 : 22 : double limYCoord[5] = {0.0, 0.0, 0.433, 0.866, 0.433};
1438 [ + + ]: 132 : for (unsigned int lbpi = 0u; lbpi < 5u; ++lbpi)
1439 : : {
1440 [ + - ]: 110 : AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]);
1441 [ + - ]: 110 : limBndryPnts.push_back(bndryPnt);
1442 : : }
1443 : :
1444 : : // define the point transforms that apply to the limiting
1445 : : // boundary points of the free zone and assemble them into a list
1446 [ + - ]: 44 : std::list<const AF2PointTransform*> limBndryTrnsfrms;
1447 [ + - ]: 22 : limBndryTrnsfrms.push_back(noTransform);
1448 [ + - ]: 22 : limBndryTrnsfrms.push_back(baseTransform);
1449 [ + - ]: 22 : limBndryTrnsfrms.push_back(limV2Transform);
1450 [ + - ]: 22 : limBndryTrnsfrms.push_back(translateToPeak);
1451 [ + - ]: 22 : limBndryTrnsfrms.push_back(limV4Transform);
1452 : :
1453 : : // define the free zone definition
1454 : : AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts,
1455 [ + - ][ + - ]: 22 : prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms);
1456 : :
1457 : : // define the new vertices that the rule would create and assemble them
1458 : : // into a list
1459 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
1460 : :
1461 : : // define the new edges and assemble them into a list
1462 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
1463 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 2));
[ + - ]
1464 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 1));
[ + - ]
1465 : :
1466 : : // define the new triangles and assemble them into a list
1467 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
1468 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2));
[ + - ]
1469 : :
1470 : : // construct the rule itself
1471 : : AF2Rule* rule =
1472 : : new AF2Rule("Connect to Opposite Vertex", 1u, existVertices,
1473 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
1474 : :
1475 : : // delete transforms that were allocated with new but cloned when
1476 : : // made part of the rule definition
1477 [ + - ]: 22 : delete translateToPeak;
1478 [ + - ]: 22 : delete baseTransform;
1479 [ + - ]: 22 : delete noTransform;
1480 [ + - ]: 22 : delete limV4Transform;
1481 [ + - ]: 22 : delete limV2Transform;
1482 [ + - ]: 22 : delete prefV4Transform;
1483 [ + - ]: 22 : delete prefV2Transform;
1484 : :
1485 : 22 : return rule;
1486 : : }
1487 : :
1488 : 22 : const AF2Rule* AF2DfltTriangleRules::makeConnectEdgeRule() const
1489 : : {
1490 : : // define the vertices that must exist
1491 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0);
1492 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0);
1493 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* oppRightExist = new AF2RuleExistVertex(1.0, 1.732);
1494 [ + - ][ + - ]: 22 : const AF2RuleExistVertex* oppLeftExist = new AF2RuleExistVertex(0.0, 1.732);
1495 : :
1496 : : // assemble the vertices that must exist into a list
1497 [ + - ]: 22 : std::list<const AF2RuleExistVertex*> existVertices;
1498 [ + - ]: 22 : existVertices.push_back(originExist);
1499 [ + - ]: 22 : existVertices.push_back(baseExist);
1500 [ + - ]: 22 : existVertices.push_back(oppRightExist);
1501 [ + - ]: 22 : existVertices.push_back(oppLeftExist);
1502 : :
1503 : : // define the baseline edge that must exist
1504 : : const AF2RuleExistEdge* baseEdge =
1505 [ + - ][ + - ]: 22 : new AF2RuleExistEdge(originExist, baseExist);
1506 : :
1507 : : // define the other edges that must exist and assemble them into a list
1508 [ + - ]: 44 : std::list<const AF2RuleExistEdge*> existEdges;
1509 [ + - ][ + - ]: 22 : existEdges.push_back(new AF2RuleExistEdge(oppRightExist, oppLeftExist));
[ + - ]
1510 : :
1511 : : // define a linear point transformation that balances the bound values of
1512 : : // the base vertex, the opposite right vertex, and the opposite left vertex
1513 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t0VertexList;
1514 [ + - ]: 44 : std::list<double> t0XCoeffList;
1515 [ + - ]: 44 : std::list<double> t0YCoeffList;
1516 : :
1517 [ + - ]: 22 : t0VertexList.push_back(baseExist);
1518 [ + - ]: 22 : t0VertexList.push_back(oppRightExist);
1519 [ + - ]: 22 : t0VertexList.push_back(oppLeftExist);
1520 [ + - ]: 22 : t0XCoeffList.push_back(0.25);
1521 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1522 [ + - ]: 22 : t0XCoeffList.push_back(0.25);
1523 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1524 [ + - ]: 22 : t0XCoeffList.push_back(0.25);
1525 [ + - ]: 22 : t0XCoeffList.push_back(0.0);
1526 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1527 [ + - ]: 22 : t0YCoeffList.push_back(0.25);
1528 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1529 [ + - ]: 22 : t0YCoeffList.push_back(0.25);
1530 [ + - ]: 22 : t0YCoeffList.push_back(0.0);
1531 [ + - ]: 22 : t0YCoeffList.push_back(0.25);
1532 : :
1533 : : AF2PointTransform* newVertexTransform =
1534 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList);
[ + - ][ + - ]
[ + - ]
1535 : :
1536 : : // define another linear point transformation that balances bound values of
1537 : : // the base vertex, the opposite right vertex, and the opposite left vertex
1538 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t1VertexList;
1539 [ + - ]: 44 : std::list<double> t1XCoeffList;
1540 [ + - ]: 44 : std::list<double> t1YCoeffList;
1541 : :
1542 [ + - ]: 22 : t1VertexList.push_back(baseExist);
1543 [ + - ]: 22 : t1VertexList.push_back(oppRightExist);
1544 [ + - ]: 22 : t1VertexList.push_back(oppLeftExist);
1545 [ + - ]: 22 : t1XCoeffList.push_back(0.75);
1546 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1547 [ + - ]: 22 : t1XCoeffList.push_back(0.75);
1548 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1549 [ + - ]: 22 : t1XCoeffList.push_back(-0.25);
1550 [ + - ]: 22 : t1XCoeffList.push_back(0.0);
1551 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1552 [ + - ]: 22 : t1YCoeffList.push_back(0.75);
1553 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1554 [ + - ]: 22 : t1YCoeffList.push_back(0.75);
1555 [ + - ]: 22 : t1YCoeffList.push_back(0.0);
1556 [ + - ]: 22 : t1YCoeffList.push_back(-0.25);
1557 : :
1558 : :
1559 : : AF2PointTransform* fzV2Transform =
1560 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList);
[ + - ][ + - ]
[ + - ]
1561 : :
1562 : : // define a third linear point transformation that balances bound values of
1563 : : // the base vertex, the opposite right vertex, and the opposite left vertex
1564 [ + - ]: 44 : std::list<const AF2RuleExistVertex*> t2VertexList;
1565 [ + - ]: 44 : std::list<double> t2XCoeffList;
1566 [ + - ]: 44 : std::list<double> t2YCoeffList;
1567 : :
1568 [ + - ]: 22 : t2VertexList.push_back(baseExist);
1569 [ + - ]: 22 : t2VertexList.push_back(oppRightExist);
1570 [ + - ]: 22 : t2VertexList.push_back(oppLeftExist);
1571 [ + - ]: 22 : t2XCoeffList.push_back(-0.25);
1572 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1573 [ + - ]: 22 : t2XCoeffList.push_back(-0.25);
1574 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1575 [ + - ]: 22 : t2XCoeffList.push_back(0.75);
1576 [ + - ]: 22 : t2XCoeffList.push_back(0.0);
1577 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1578 [ + - ]: 22 : t2YCoeffList.push_back(-0.25);
1579 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1580 [ + - ]: 22 : t2YCoeffList.push_back(-0.25);
1581 [ + - ]: 22 : t2YCoeffList.push_back(0.0);
1582 [ + - ]: 22 : t2YCoeffList.push_back(0.75);
1583 : :
1584 : :
1585 : : AF2PointTransform* fzV5Transform =
1586 [ + - ][ + - ]: 22 : new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList);
[ + - ][ + - ]
[ + - ]
1587 : :
1588 : : // define the reference boundary points of the free zone
1589 : : // and assemble them into a list
1590 [ + - ]: 44 : std::list<AF2Point2D> fzBndryPnts;
1591 : 22 : double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5};
1592 : 22 : double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866};
1593 [ + + ]: 154 : for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi)
1594 : : {
1595 [ + - ]: 132 : AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]);
1596 [ + - ]: 132 : fzBndryPnts.push_back(bndryPnt);
1597 : : }
1598 : :
1599 : : // define the point transforms that apply to the boundary points
1600 : : // of the free zone and assemble them into a list
1601 [ + - ]: 44 : std::list<const AF2PointTransform*> fzBndryTrnsfrms;
1602 [ + - ]: 22 : AF2PointTransform* noTransform = new AF2PointTransformNone();
1603 [ + - ]: 22 : AF2PointTransform* baseTransform = makeTranslation(baseExist);
1604 [ + - ]: 22 : AF2PointTransform* translateToOppRight = makeTranslation(oppRightExist);
1605 [ + - ]: 22 : AF2PointTransform* translateToOppLeft = makeTranslation(oppLeftExist);
1606 [ + - ]: 22 : fzBndryTrnsfrms.push_back(noTransform);
1607 [ + - ]: 22 : fzBndryTrnsfrms.push_back(baseTransform);
1608 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV2Transform);
1609 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToOppRight);
1610 [ + - ]: 22 : fzBndryTrnsfrms.push_back(translateToOppLeft);
1611 [ + - ]: 22 : fzBndryTrnsfrms.push_back(fzV5Transform);
1612 : :
1613 : : // define the free zone definition
1614 : : AF2FreeZoneDef* freeZoneDef =
1615 [ + - ][ + - ]: 22 : new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms);
1616 : :
1617 : : // define the new vertices that the rule would create and assemble them
1618 : : // into a list
1619 [ + - ]: 44 : std::list<const AF2RuleNewVertex*> newVertices;
1620 [ + - ]: 22 : AF2Point2D nvRefPoint(0.5, 0.866);
1621 [ + - ][ + - ]: 22 : newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform));
[ + - ]
1622 : :
1623 : : // define the new edges and assemble them into a list
1624 [ + - ]: 44 : std::list<const AF2RuleNewEdge*> newEdges;
1625 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(0, 4));
[ + - ]
1626 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(2, 4));
[ + - ]
1627 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(4, 1));
[ + - ]
1628 [ + - ][ + - ]: 22 : newEdges.push_back(new AF2RuleNewEdge(4, 3));
[ + - ]
1629 : :
1630 : : // define the new triangles and assemble them into a list
1631 [ + - ]: 44 : std::list<const AF2RuleNewFace*> newTriangles;
1632 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 4));
[ + - ]
1633 [ + - ][ + - ]: 22 : newTriangles.push_back(new AF2RuleNewTriangle(2, 3, 4));
[ + - ]
1634 : :
1635 : : // construct the rule itself
1636 : : AF2Rule* rule =
1637 : : new AF2Rule("Connect to Opposite Edge", 3u, existVertices,
1638 [ + - ][ + - ]: 22 : baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles);
[ + - ]
1639 : :
1640 : : // delete transforms that were allocated with new but cloned when
1641 : : // made part of the rule definition
1642 [ + - ]: 22 : delete translateToOppLeft;
1643 [ + - ]: 22 : delete translateToOppRight;
1644 [ + - ]: 22 : delete baseTransform;
1645 [ + - ]: 22 : delete noTransform;
1646 [ + - ]: 22 : delete fzV5Transform;
1647 [ + - ]: 22 : delete fzV2Transform;
1648 [ + - ]: 22 : delete newVertexTransform;
1649 : :
1650 : 22 : return rule;
1651 : : }
|