MeshKit
1.0
|
00001 #include "meshkit/AF2DfltTriangleRules.hpp" 00002 00003 // C++ 00004 #include <list> 00005 00006 // MeshKit 00007 #include "meshkit/AF2FreeZoneDef.hpp" 00008 #include "meshkit/AF2FreeZoneDefLCQualLim.hpp" 00009 #include "meshkit/AF2FreeZoneDefSimple.hpp" 00010 #include "meshkit/AF2PntTrnsfrmLnrV.hpp" 00011 #include "meshkit/AF2Point2D.hpp" 00012 #include "meshkit/AF2PointTransformNone.hpp" 00013 #include "meshkit/AF2RuleExistEdge.hpp" 00014 #include "meshkit/AF2RuleExistVertex.hpp" 00015 #include "meshkit/AF2RuleNewEdge.hpp" 00016 #include "meshkit/AF2RuleNewFace.hpp" 00017 #include "meshkit/AF2RuleNewTriangle.hpp" 00018 #include "meshkit/AF2RuleNewVertex.hpp" 00019 #include "meshkit/Error.hpp" 00020 00021 AF2DfltTriangleRules::AF2DfltTriangleRules() 00022 { 00023 ruleList.push_back(make180DegreeRuleQ1()); 00024 ruleList.push_back(make180DegreeRuleQ5()); 00025 ruleList.push_back(make180DegreeRuleQ10()); 00026 ruleList.push_back(make180DegreeRuleQ20()); 00027 ruleList.push_back(make60DegreeAngleRightRule()); 00028 ruleList.push_back(make60DegreeAngleLeftRule()); 00029 ruleList.push_back(make120DegreeAngleRightRule()); 00030 ruleList.push_back(make120DegreeAngleLeftRule()); 00031 ruleList.push_back(make120DegreeAngleBothRule()); 00032 ruleList.push_back(makeFillTriangleRule()); 00033 ruleList.push_back(makeConnectVertexRule()); 00034 ruleList.push_back(makeConnectEdgeRule()); 00035 } 00036 00037 AF2DfltTriangleRules::~AF2DfltTriangleRules() 00038 { 00039 typedef std::list<const AF2Rule*>::iterator RuleListItr; 00040 for (RuleListItr itr = ruleList.begin(); itr != ruleList.end(); ++itr) 00041 { 00042 delete *itr; 00043 } 00044 } 00045 00046 AF2DfltTriangleRules::AF2DfltTriangleRules(const AF2DfltTriangleRules & toCopy) 00047 { 00048 MeshKit::Error notImpl(MeshKit::MK_NOT_IMPLEMENTED); 00049 notImpl.set_string( 00050 "AF2DfltTriangleRules copy constructor is not supported."); 00051 throw notImpl; 00052 } 00053 00054 AF2DfltTriangleRules& AF2DfltTriangleRules::operator=(const AF2DfltTriangleRules & rhs) 00055 { 00056 MeshKit::Error notImpl(MeshKit::MK_NOT_IMPLEMENTED); 00057 notImpl.set_string( 00058 "AF2DfltTriangleRules assignment operator is not supported."); 00059 throw notImpl; 00060 } 00061 00062 std::list<const AF2Rule*> AF2DfltTriangleRules::getRules() const 00063 { 00064 return ruleList; 00065 } 00066 00067 AF2PntTrnsfrmLnrV* AF2DfltTriangleRules::makeLinearTransformX( 00068 const AF2RuleExistVertex* ruleExVert, double xCoeff) const 00069 { 00070 std::list<const AF2RuleExistVertex*> vertexList; 00071 std::list<double> xCoeffList; 00072 std::list<double> yCoeffList; 00073 00074 vertexList.push_back(ruleExVert); 00075 xCoeffList.push_back(xCoeff); 00076 xCoeffList.push_back(0.0); 00077 yCoeffList.push_back(0.0); 00078 yCoeffList.push_back(0.0); 00079 00080 return new AF2PntTrnsfrmLnrV(vertexList, xCoeffList, yCoeffList); 00081 } 00082 00083 AF2PntTrnsfrmLnrV* AF2DfltTriangleRules::makeTranslation( 00084 const AF2RuleExistVertex* ruleExVert) const 00085 { 00086 std::list<const AF2RuleExistVertex*> vertexList; 00087 std::list<double> xCoeffList; 00088 std::list<double> yCoeffList; 00089 00090 vertexList.push_back(ruleExVert); 00091 xCoeffList.push_back(1.0); 00092 xCoeffList.push_back(0.0); 00093 yCoeffList.push_back(0.0); 00094 yCoeffList.push_back(1.0); 00095 00096 return new AF2PntTrnsfrmLnrV(vertexList, xCoeffList, yCoeffList); 00097 } 00098 00099 const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ1() const 00100 { 00101 // define the vertices that must exist 00102 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00103 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00104 00105 // assemble the vertices that must exist into a list 00106 std::list<const AF2RuleExistVertex*> existVertices; 00107 existVertices.push_back(originExist); 00108 existVertices.push_back(baseExist); 00109 00110 // define the baseline edge that must exist 00111 const AF2RuleExistEdge* baseEdge = 00112 new AF2RuleExistEdge(originExist, baseExist); 00113 00114 // define the other edges that must exist 00115 00116 // assemble the non-baseline edges that must exist into a list 00117 std::list<const AF2RuleExistEdge*> existEdges; 00118 00119 // define the reference preferred boundary points of the free zone 00120 // and assemble them into a list 00121 std::list<AF2Point2D> prefBndryPnts; 00122 double prefXCoord[5] = {0.0, 1.0, 1.5, 0.5, -0.5}; 00123 double prefYCoord[5] = {0.0, 0.0, 0.7, 1.5, 0.7}; 00124 for (unsigned int pbpi = 0u; pbpi < 5u; ++pbpi) 00125 { 00126 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00127 prefBndryPnts.push_back(bndryPnt); 00128 } 00129 00130 // define the point transforms that apply to the preferred 00131 // boundary points of the free zone and assemble them into a list 00132 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00133 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00134 AF2PointTransform* baseXTransform = 00135 makeLinearTransformX(baseExist, 1.0); 00136 AF2PointTransform* halfBaseXTransform = 00137 makeLinearTransformX(baseExist, 0.5); 00138 prefBndryTrnsfrms.push_back(noTransform); 00139 prefBndryTrnsfrms.push_back(baseXTransform); 00140 prefBndryTrnsfrms.push_back(halfBaseXTransform); 00141 prefBndryTrnsfrms.push_back(halfBaseXTransform); 00142 prefBndryTrnsfrms.push_back(halfBaseXTransform); 00143 00144 // define the reference limiting boundary points of the free zone 00145 // and assemble them into a list 00146 std::list<AF2Point2D> limBndryPnts; 00147 double limXCoord[5] = {0.0, 1.0, 0.5, 0.5, 0.5}; 00148 double limYCoord[5] = {0.0, 0.0, 0.866, 0.866, 0.866}; 00149 for (unsigned int lbpi = 0u; lbpi < 5u; ++lbpi) 00150 { 00151 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00152 limBndryPnts.push_back(bndryPnt); 00153 } 00154 00155 // define the point transforms that apply to the limiting 00156 // boundary points of the free zone and assemble them into a list 00157 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00158 limBndryTrnsfrms.push_back(noTransform); 00159 limBndryTrnsfrms.push_back(baseXTransform); 00160 limBndryTrnsfrms.push_back(halfBaseXTransform); 00161 limBndryTrnsfrms.push_back(halfBaseXTransform); 00162 limBndryTrnsfrms.push_back(halfBaseXTransform); 00163 00164 // define the free zone definition 00165 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00166 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00167 00168 // define the new vertices that the rule would create and assemble them 00169 // into a list 00170 std::list<const AF2RuleNewVertex*> newVertices; 00171 AF2Point2D nvRefPoint(0.5, 0.866); 00172 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform)); 00173 00174 // define the new edges and assemble them into a list 00175 std::list<const AF2RuleNewEdge*> newEdges; 00176 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 00177 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 00178 00179 // define the new triangles and assemble them into a list 00180 std::list<const AF2RuleNewFace*> newTriangles; 00181 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00182 00183 // construct the rule itself 00184 AF2Rule* rule = 00185 new AF2Rule("Triangle Off Line, Quality Level 1", 1u, existVertices, 00186 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00187 00188 // delete transforms that were allocated with new but cloned when 00189 // made part of the rule definition 00190 delete halfBaseXTransform; 00191 delete baseXTransform; 00192 delete noTransform; 00193 00194 return rule; 00195 } 00196 00197 const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ5() const 00198 { 00199 // define the vertices that must exist 00200 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00201 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00202 00203 // assemble the vertices that must exist into a list 00204 std::list<const AF2RuleExistVertex*> existVertices; 00205 existVertices.push_back(originExist); 00206 existVertices.push_back(baseExist); 00207 00208 // define the baseline edge that must exist 00209 const AF2RuleExistEdge* baseEdge = 00210 new AF2RuleExistEdge(originExist, baseExist); 00211 00212 // define the other edges that must exist 00213 00214 // assemble the non-baseline edges that must exist into a list 00215 std::list<const AF2RuleExistEdge*> existEdges; 00216 00217 // define the reference preferred boundary points of the free zone 00218 // and assemble them into a list 00219 std::list<AF2Point2D> prefBndryPnts; 00220 double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0}; 00221 double prefYCoord[4] = {0.0, 0.0, 0.7, 0.7}; 00222 for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi) 00223 { 00224 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00225 prefBndryPnts.push_back(bndryPnt); 00226 } 00227 00228 // define the point transforms that apply to the preferred 00229 // boundary points of the free zone and assemble them into a list 00230 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00231 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00232 AF2PointTransform* baseXTransform = 00233 makeLinearTransformX(baseExist, 1.0); 00234 AF2PointTransform* halfBaseXTransform = 00235 makeLinearTransformX(baseExist, 0.5); 00236 prefBndryTrnsfrms.push_back(noTransform); 00237 prefBndryTrnsfrms.push_back(baseXTransform); 00238 prefBndryTrnsfrms.push_back(baseXTransform); 00239 prefBndryTrnsfrms.push_back(noTransform); 00240 00241 // define the reference limiting boundary points of the free zone 00242 // and assemble them into a list 00243 std::list<AF2Point2D> limBndryPnts; 00244 double limXCoord[4] = {0.0, 1.0, 0.5, 0.5}; 00245 double limYCoord[4] = {0.0, 0.0, 0.5, 0.5}; 00246 for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi) 00247 { 00248 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00249 limBndryPnts.push_back(bndryPnt); 00250 } 00251 00252 // define the point transforms that apply to the limiting 00253 // boundary points of the free zone and assemble them into a list 00254 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00255 limBndryTrnsfrms.push_back(noTransform); 00256 limBndryTrnsfrms.push_back(baseXTransform); 00257 limBndryTrnsfrms.push_back(halfBaseXTransform); 00258 limBndryTrnsfrms.push_back(halfBaseXTransform); 00259 00260 // define the free zone definition 00261 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00262 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00263 00264 // define the new vertices that the rule would create and assemble them 00265 // into a list 00266 std::list<const AF2RuleNewVertex*> newVertices; 00267 AF2Point2D nvRefPoint(0.5, 0.5); 00268 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform)); 00269 00270 // define the new edges and assemble them into a list 00271 std::list<const AF2RuleNewEdge*> newEdges; 00272 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 00273 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 00274 00275 // define the new triangles and assemble them into a list 00276 std::list<const AF2RuleNewFace*> newTriangles; 00277 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00278 00279 // construct the rule itself 00280 AF2Rule* rule = 00281 new AF2Rule("Triangle Off Line, Quality Level 5", 5u, existVertices, 00282 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00283 00284 // delete transforms that were allocated with new but cloned when 00285 // made part of the rule definition 00286 delete halfBaseXTransform; 00287 delete baseXTransform; 00288 delete noTransform; 00289 00290 return rule; 00291 } 00292 00293 const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ10() const 00294 { 00295 // define the vertices that must exist 00296 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00297 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00298 00299 // assemble the vertices that must exist into a list 00300 std::list<const AF2RuleExistVertex*> existVertices; 00301 existVertices.push_back(originExist); 00302 existVertices.push_back(baseExist); 00303 00304 // define the baseline edge that must exist 00305 const AF2RuleExistEdge* baseEdge = 00306 new AF2RuleExistEdge(originExist, baseExist); 00307 00308 // define the other edges that must exist 00309 00310 // assemble the non-baseline edges that must exist into a list 00311 std::list<const AF2RuleExistEdge*> existEdges; 00312 00313 // define the reference preferred boundary points of the free zone 00314 // and assemble them into a list 00315 std::list<AF2Point2D> prefBndryPnts; 00316 double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0}; 00317 double prefYCoord[4] = {0.0, 0.0, 0.5, 0.5}; 00318 for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi) 00319 { 00320 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00321 prefBndryPnts.push_back(bndryPnt); 00322 } 00323 00324 // define the point transforms that apply to the preferred 00325 // boundary points of the free zone and assemble them into a list 00326 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00327 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00328 AF2PointTransform* baseXTransform = 00329 makeLinearTransformX(baseExist, 1.0); 00330 AF2PointTransform* halfBaseXTransform = 00331 makeLinearTransformX(baseExist, 0.5); 00332 prefBndryTrnsfrms.push_back(noTransform); 00333 prefBndryTrnsfrms.push_back(baseXTransform); 00334 prefBndryTrnsfrms.push_back(baseXTransform); 00335 prefBndryTrnsfrms.push_back(noTransform); 00336 00337 // define the reference limiting boundary points of the free zone 00338 // and assemble them into a list 00339 std::list<AF2Point2D> limBndryPnts; 00340 double limXCoord[4] = {0.0, 1.0, 0.5, 0.5}; 00341 double limYCoord[4] = {0.0, 0.0, 0.3, 0.3}; 00342 for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi) 00343 { 00344 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00345 limBndryPnts.push_back(bndryPnt); 00346 } 00347 00348 // define the point transforms that apply to the limiting 00349 // boundary points of the free zone and assemble them into a list 00350 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00351 limBndryTrnsfrms.push_back(noTransform); 00352 limBndryTrnsfrms.push_back(baseXTransform); 00353 limBndryTrnsfrms.push_back(halfBaseXTransform); 00354 limBndryTrnsfrms.push_back(halfBaseXTransform); 00355 00356 // define the free zone definition 00357 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00358 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00359 00360 // define the new vertices that the rule would create and assemble them 00361 // into a list 00362 std::list<const AF2RuleNewVertex*> newVertices; 00363 AF2Point2D nvRefPoint(0.5, 0.3); 00364 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform)); 00365 00366 // define the new edges and assemble them into a list 00367 std::list<const AF2RuleNewEdge*> newEdges; 00368 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 00369 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 00370 00371 // define the new triangles and assemble them into a list 00372 std::list<const AF2RuleNewFace*> newTriangles; 00373 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00374 00375 // construct the rule itself 00376 AF2Rule* rule = 00377 new AF2Rule("Triangle Off Line, Quality Level 10", 10u, existVertices, 00378 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00379 00380 // delete transforms that were allocated with new but cloned when 00381 // made part of the rule definition 00382 delete halfBaseXTransform; 00383 delete baseXTransform; 00384 delete noTransform; 00385 00386 return rule; 00387 } 00388 00389 const AF2Rule* AF2DfltTriangleRules::make180DegreeRuleQ20() const 00390 { 00391 // define the vertices that must exist 00392 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00393 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00394 00395 // assemble the vertices that must exist into a list 00396 std::list<const AF2RuleExistVertex*> existVertices; 00397 existVertices.push_back(originExist); 00398 existVertices.push_back(baseExist); 00399 00400 // define the baseline edge that must exist 00401 const AF2RuleExistEdge* baseEdge = 00402 new AF2RuleExistEdge(originExist, baseExist); 00403 00404 // define the other edges that must exist 00405 00406 // assemble the non-baseline edges that must exist into a list 00407 std::list<const AF2RuleExistEdge*> existEdges; 00408 00409 // define the reference preferred boundary points of the free zone 00410 // and assemble them into a list 00411 std::list<AF2Point2D> prefBndryPnts; 00412 double prefXCoord[4] = {0.0, 1.0, 1.0, 0.0}; 00413 double prefYCoord[4] = {0.0, 0.0, 0.2, 0.2}; 00414 for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi) 00415 { 00416 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00417 prefBndryPnts.push_back(bndryPnt); 00418 } 00419 00420 // define the point transforms that apply to the preferred 00421 // boundary points of the free zone and assemble them into a list 00422 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00423 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00424 AF2PointTransform* baseXTransform = 00425 makeLinearTransformX(baseExist, 1.0); 00426 AF2PointTransform* halfBaseXTransform = 00427 makeLinearTransformX(baseExist, 0.5); 00428 prefBndryTrnsfrms.push_back(noTransform); 00429 prefBndryTrnsfrms.push_back(baseXTransform); 00430 prefBndryTrnsfrms.push_back(baseXTransform); 00431 prefBndryTrnsfrms.push_back(noTransform); 00432 00433 // define the reference limiting boundary points of the free zone 00434 // and assemble them into a list 00435 std::list<AF2Point2D> limBndryPnts; 00436 double limXCoord[4] = {0.0, 1.0, 0.5, 0.5}; 00437 double limYCoord[4] = {0.0, 0.0, 0.1, 0.1}; 00438 for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi) 00439 { 00440 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00441 limBndryPnts.push_back(bndryPnt); 00442 } 00443 00444 // define the point transforms that apply to the limiting 00445 // boundary points of the free zone and assemble them into a list 00446 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00447 limBndryTrnsfrms.push_back(noTransform); 00448 limBndryTrnsfrms.push_back(baseXTransform); 00449 limBndryTrnsfrms.push_back(halfBaseXTransform); 00450 limBndryTrnsfrms.push_back(halfBaseXTransform); 00451 00452 // define the free zone definition 00453 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00454 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00455 00456 // define the new vertices that the rule would create and assemble them 00457 // into a list 00458 std::list<const AF2RuleNewVertex*> newVertices; 00459 AF2Point2D nvRefPoint(0.5, 0.1); 00460 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, halfBaseXTransform)); 00461 00462 // define the new edges and assemble them into a list 00463 std::list<const AF2RuleNewEdge*> newEdges; 00464 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 00465 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 00466 00467 // define the new triangles and assemble them into a list 00468 std::list<const AF2RuleNewFace*> newTriangles; 00469 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00470 00471 // construct the rule itself 00472 AF2Rule* rule = 00473 new AF2Rule("Triangle Off Line, Quality Level 20", 20u, existVertices, 00474 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00475 00476 // delete transforms that were allocated with new but cloned when 00477 // made part of the rule definition 00478 delete halfBaseXTransform; 00479 delete baseXTransform; 00480 delete noTransform; 00481 00482 return rule; 00483 } 00484 00485 const AF2Rule* AF2DfltTriangleRules::make60DegreeAngleRightRule() const 00486 { 00487 // define the vertices that must exist 00488 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00489 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00490 const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866); 00491 00492 // assemble the vertices that must exist into a list 00493 std::list<const AF2RuleExistVertex*> existVertices; 00494 existVertices.push_back(originExist); 00495 existVertices.push_back(baseExist); 00496 existVertices.push_back(peakExist); 00497 00498 // define the baseline edge that must exist 00499 const AF2RuleExistEdge* baseEdge = 00500 new AF2RuleExistEdge(originExist, baseExist); 00501 00502 // define the other edges that must exist and assemble them into a list 00503 std::list<const AF2RuleExistEdge*> existEdges; 00504 existEdges.push_back(new AF2RuleExistEdge(baseExist, peakExist)); 00505 00506 // define a linear point transformation that balances the bound 00507 // value of the base vertex and the peak vertex 00508 std::list<const AF2RuleExistVertex*> t0VertexList; 00509 std::list<double> t0XCoeffList; 00510 std::list<double> t0YCoeffList; 00511 00512 t0VertexList.push_back(baseExist); 00513 t0VertexList.push_back(peakExist); 00514 t0XCoeffList.push_back(-0.5); 00515 t0XCoeffList.push_back(0.0); 00516 t0XCoeffList.push_back(0.75); 00517 t0XCoeffList.push_back(0.0); 00518 t0YCoeffList.push_back(0.0); 00519 t0YCoeffList.push_back(-0.5); 00520 t0YCoeffList.push_back(0.0); 00521 t0YCoeffList.push_back(0.75); 00522 00523 AF2PointTransform* prefV3Transform = 00524 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 00525 00526 // define a linear point transformation that uses the bound 00527 // value of the peak vertex, but has coefficients of 0.5 instead of 1.0 00528 std::list<const AF2RuleExistVertex*> t1VertexList; 00529 std::list<double> t1XCoeffList; 00530 std::list<double> t1YCoeffList; 00531 00532 t1VertexList.push_back(peakExist); 00533 t1XCoeffList.push_back(0.5); 00534 t1XCoeffList.push_back(0.0); 00535 t1YCoeffList.push_back(0.0); 00536 t1YCoeffList.push_back(0.5); 00537 00538 AF2PointTransform* limV3Transform = 00539 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 00540 00541 // define the reference preferred boundary points of the free zone 00542 // and assemble them into a list 00543 std::list<AF2Point2D> prefBndryPnts; 00544 double prefXCoord[4] = {0.0, 1.0, 0.5, -0.125}; 00545 double prefYCoord[4] = {0.0, 0.0, 0.866, 0.6495}; 00546 for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi) 00547 { 00548 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00549 prefBndryPnts.push_back(bndryPnt); 00550 } 00551 00552 // define the point transforms that apply to the preferred 00553 // boundary points of the free zone and assemble them into a list 00554 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00555 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00556 AF2PointTransform* baseXTransform = 00557 makeLinearTransformX(baseExist, 1.0); 00558 AF2PointTransform* translateToPeak = makeTranslation(peakExist); 00559 prefBndryTrnsfrms.push_back(noTransform); 00560 prefBndryTrnsfrms.push_back(baseXTransform); 00561 prefBndryTrnsfrms.push_back(translateToPeak); 00562 prefBndryTrnsfrms.push_back(prefV3Transform); 00563 00564 // define the reference limiting boundary points of the free zone 00565 // and assemble them into a list 00566 std::list<AF2Point2D> limBndryPnts; 00567 double limXCoord[4] = {0.0, 1.0, 0.5, 0.25}; 00568 double limYCoord[4] = {0.0, 0.0, 0.866, 0.433}; 00569 for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi) 00570 { 00571 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00572 limBndryPnts.push_back(bndryPnt); 00573 } 00574 00575 // define the point transforms that apply to the limiting 00576 // boundary points of the free zone and assemble them into a list 00577 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00578 limBndryTrnsfrms.push_back(noTransform); 00579 limBndryTrnsfrms.push_back(baseXTransform); 00580 limBndryTrnsfrms.push_back(translateToPeak); 00581 limBndryTrnsfrms.push_back(limV3Transform); 00582 00583 // define the free zone definition 00584 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00585 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00586 00587 // define the new vertices that the rule would create and assemble them 00588 // into a list 00589 std::list<const AF2RuleNewVertex*> newVertices; 00590 00591 // define the new edges and assemble them into a list 00592 std::list<const AF2RuleNewEdge*> newEdges; 00593 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 00594 00595 // define the new triangles and assemble them into a list 00596 std::list<const AF2RuleNewFace*> newTriangles; 00597 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00598 00599 // construct the rule itself 00600 AF2Rule* rule = 00601 new AF2Rule("Angle at Right Vertex of 60 Degrees", 1u, existVertices, 00602 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00603 00604 // delete transforms that were allocated with new but cloned when 00605 // made part of the rule definition 00606 delete translateToPeak; 00607 delete baseXTransform; 00608 delete noTransform; 00609 delete limV3Transform; 00610 delete prefV3Transform; 00611 00612 return rule; 00613 } 00614 00615 const AF2Rule* AF2DfltTriangleRules::make60DegreeAngleLeftRule() const 00616 { 00617 // define the vertices that must exist 00618 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00619 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00620 const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866); 00621 00622 // assemble the vertices that must exist into a list 00623 std::list<const AF2RuleExistVertex*> existVertices; 00624 existVertices.push_back(originExist); 00625 existVertices.push_back(baseExist); 00626 existVertices.push_back(peakExist); 00627 00628 // define the baseline edge that must exist 00629 const AF2RuleExistEdge* baseEdge = 00630 new AF2RuleExistEdge(originExist, baseExist); 00631 00632 // define the other edges that must exist and assemble them into a list 00633 std::list<const AF2RuleExistEdge*> existEdges; 00634 existEdges.push_back(new AF2RuleExistEdge(peakExist, originExist)); 00635 00636 // define a linear point transformation that balances the bound 00637 // value of the base vertex and the peak vertex 00638 std::list<const AF2RuleExistVertex*> t0VertexList; 00639 std::list<double> t0XCoeffList; 00640 std::list<double> t0YCoeffList; 00641 00642 t0VertexList.push_back(baseExist); 00643 t0VertexList.push_back(peakExist); 00644 t0XCoeffList.push_back(0.75); 00645 t0XCoeffList.push_back(0.0); 00646 t0XCoeffList.push_back(0.75); 00647 t0XCoeffList.push_back(0.0); 00648 t0YCoeffList.push_back(0.0); 00649 t0YCoeffList.push_back(0.75); 00650 t0YCoeffList.push_back(0.0); 00651 t0YCoeffList.push_back(0.75); 00652 00653 AF2PointTransform* prefV2Transform = 00654 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 00655 00656 // define a linear point transformation that translates by the difference 00657 // between the bound value and reference value of the midpoint 00658 // between the base vertex and peak vertex 00659 std::list<const AF2RuleExistVertex*> t1VertexList; 00660 std::list<double> t1XCoeffList; 00661 std::list<double> t1YCoeffList; 00662 00663 t1VertexList.push_back(baseExist); 00664 t1VertexList.push_back(peakExist); 00665 t1XCoeffList.push_back(0.5); 00666 t1XCoeffList.push_back(0.0); 00667 t1XCoeffList.push_back(0.5); 00668 t1XCoeffList.push_back(0.0); 00669 t1YCoeffList.push_back(0.0); 00670 t1YCoeffList.push_back(0.5); 00671 t1YCoeffList.push_back(0.0); 00672 t1YCoeffList.push_back(0.5); 00673 00674 AF2PointTransform* limV2Transform = 00675 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 00676 00677 // define the reference preferred boundary points of the free zone 00678 // and assemble them into a list 00679 std::list<AF2Point2D> prefBndryPnts; 00680 double prefXCoord[4] = {0.0, 1.0, 1.125, 0.5}; 00681 double prefYCoord[4] = {0.0, 0.0, 0.6495, 0.866}; 00682 for (unsigned int pbpi = 0u; pbpi < 4u; ++pbpi) 00683 { 00684 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00685 prefBndryPnts.push_back(bndryPnt); 00686 } 00687 00688 // define the point transforms that apply to the preferred 00689 // boundary points of the free zone and assemble them into a list 00690 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 00691 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00692 AF2PointTransform* baseXTransform = 00693 makeLinearTransformX(baseExist, 1.0); 00694 AF2PointTransform* translateToPeak = makeTranslation(peakExist); 00695 prefBndryTrnsfrms.push_back(noTransform); 00696 prefBndryTrnsfrms.push_back(baseXTransform); 00697 prefBndryTrnsfrms.push_back(prefV2Transform); 00698 prefBndryTrnsfrms.push_back(translateToPeak); 00699 00700 // define the reference limiting boundary points of the free zone 00701 // and assemble them into a list 00702 std::list<AF2Point2D> limBndryPnts; 00703 double limXCoord[4] = {0.0, 1.0, 0.75, 0.5}; 00704 double limYCoord[4] = {0.0, 0.0, 0.433, 0.866}; 00705 for (unsigned int lbpi = 0u; lbpi < 4u; ++lbpi) 00706 { 00707 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 00708 limBndryPnts.push_back(bndryPnt); 00709 } 00710 00711 // define the point transforms that apply to the limiting 00712 // boundary points of the free zone and assemble them into a list 00713 std::list<const AF2PointTransform*> limBndryTrnsfrms; 00714 limBndryTrnsfrms.push_back(noTransform); 00715 limBndryTrnsfrms.push_back(baseXTransform); 00716 limBndryTrnsfrms.push_back(limV2Transform); 00717 limBndryTrnsfrms.push_back(translateToPeak); 00718 00719 // define the free zone definition 00720 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 00721 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 00722 00723 // define the new vertices that the rule would create and assemble them 00724 // into a list 00725 std::list<const AF2RuleNewVertex*> newVertices; 00726 00727 // define the new edges and assemble them into a list 00728 std::list<const AF2RuleNewEdge*> newEdges; 00729 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 00730 00731 // define the new triangles and assemble them into a list 00732 std::list<const AF2RuleNewFace*> newTriangles; 00733 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 00734 00735 // construct the rule itself 00736 AF2Rule* rule = 00737 new AF2Rule("Angle at Left Vertex of 60 Degrees", 1u, existVertices, 00738 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00739 00740 // delete transforms that were allocated with new but cloned when 00741 // made part of the rule definition 00742 delete translateToPeak; 00743 delete baseXTransform; 00744 delete noTransform; 00745 delete limV2Transform; 00746 delete prefV2Transform; 00747 00748 return rule; 00749 } 00750 00751 const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleRightRule() const 00752 { 00753 // define the vertices that must exist 00754 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00755 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00756 const AF2RuleExistVertex* highRightExist = 00757 new AF2RuleExistVertex(1.5, 0.866); 00758 00759 // assemble the vertices that must exist into a list 00760 std::list<const AF2RuleExistVertex*> existVertices; 00761 existVertices.push_back(originExist); 00762 existVertices.push_back(baseExist); 00763 existVertices.push_back(highRightExist); 00764 00765 // define the baseline edge that must exist 00766 const AF2RuleExistEdge* baseEdge = 00767 new AF2RuleExistEdge(originExist, baseExist); 00768 00769 // define the other edges that must exist and assemble them into a list 00770 std::list<const AF2RuleExistEdge*> existEdges; 00771 existEdges.push_back(new AF2RuleExistEdge(baseExist, highRightExist)); 00772 00773 // define a linear point transformation that depends on 00774 // the base vertex and highRight vertex 00775 std::list<const AF2RuleExistVertex*> t0VertexList; 00776 std::list<double> t0XCoeffList; 00777 std::list<double> t0YCoeffList; 00778 00779 t0VertexList.push_back(baseExist); 00780 t0VertexList.push_back(highRightExist); 00781 t0XCoeffList.push_back(-1.0); 00782 t0XCoeffList.push_back(0.0); 00783 t0XCoeffList.push_back(1.0); 00784 t0XCoeffList.push_back(0.0); 00785 t0YCoeffList.push_back(0.0); 00786 t0YCoeffList.push_back(-1.0); 00787 t0YCoeffList.push_back(0.0); 00788 t0YCoeffList.push_back(1.0); 00789 00790 AF2PointTransform* newVertexTransform = 00791 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 00792 00793 // define another linear point transformation that depends on 00794 // the base vertex and highRight vertex 00795 std::list<const AF2RuleExistVertex*> t1VertexList; 00796 std::list<double> t1XCoeffList; 00797 std::list<double> t1YCoeffList; 00798 00799 t1VertexList.push_back(baseExist); 00800 t1VertexList.push_back(highRightExist); 00801 t1XCoeffList.push_back(-2.0); 00802 t1XCoeffList.push_back(0.0); 00803 t1XCoeffList.push_back(2.0); 00804 t1XCoeffList.push_back(0.0); 00805 t1YCoeffList.push_back(0.0); 00806 t1YCoeffList.push_back(-2.0); 00807 t1YCoeffList.push_back(0.0); 00808 t1YCoeffList.push_back(2.0); 00809 00810 AF2PointTransform* fzV3Transform = 00811 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 00812 00813 // define a third linear point transformation that depends on 00814 // the base vertex and highRight vertex 00815 std::list<const AF2RuleExistVertex*> t2VertexList; 00816 std::list<double> t2XCoeffList; 00817 std::list<double> t2YCoeffList; 00818 00819 t2VertexList.push_back(baseExist); 00820 t2VertexList.push_back(highRightExist); 00821 t2XCoeffList.push_back(-3.0); 00822 t2XCoeffList.push_back(0.0); 00823 t2XCoeffList.push_back(2.0); 00824 t2XCoeffList.push_back(0.0); 00825 t2YCoeffList.push_back(0.0); 00826 t2YCoeffList.push_back(-3.0); 00827 t2YCoeffList.push_back(0.0); 00828 t2YCoeffList.push_back(2.0); 00829 00830 AF2PointTransform* fzV4Transform = 00831 new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList); 00832 00833 // define a fourth linear point transformation that depends on 00834 // the base vertex and highRight vertex 00835 std::list<const AF2RuleExistVertex*> t3VertexList; 00836 std::list<double> t3XCoeffList; 00837 std::list<double> t3YCoeffList; 00838 00839 t3VertexList.push_back(baseExist); 00840 t3VertexList.push_back(highRightExist); 00841 t3XCoeffList.push_back(-2.0); 00842 t3XCoeffList.push_back(0.0); 00843 t3XCoeffList.push_back(1.0); 00844 t3XCoeffList.push_back(0.0); 00845 t3YCoeffList.push_back(0.0); 00846 t3YCoeffList.push_back(-2.0); 00847 t3YCoeffList.push_back(0.0); 00848 t3YCoeffList.push_back(1.0); 00849 00850 AF2PointTransform* fzV5Transform = 00851 new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList); 00852 00853 // define the reference boundary points of the free zone 00854 // and assemble them into a list 00855 std::list<AF2Point2D> fzBndryPnts; 00856 double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5}; 00857 double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866}; 00858 for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi) 00859 { 00860 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 00861 fzBndryPnts.push_back(bndryPnt); 00862 } 00863 00864 // define the point transforms that apply to the boundary points 00865 // of the free zone and assemble them into a list 00866 std::list<const AF2PointTransform*> fzBndryTrnsfrms; 00867 AF2PointTransform* noTransform = new AF2PointTransformNone(); 00868 AF2PointTransform* baseXTransform = 00869 makeLinearTransformX(baseExist, 1.0); 00870 AF2PointTransform* translateToHighRight = makeTranslation(highRightExist); 00871 fzBndryTrnsfrms.push_back(noTransform); 00872 fzBndryTrnsfrms.push_back(baseXTransform); 00873 fzBndryTrnsfrms.push_back(translateToHighRight); 00874 fzBndryTrnsfrms.push_back(fzV3Transform); 00875 fzBndryTrnsfrms.push_back(fzV4Transform); 00876 fzBndryTrnsfrms.push_back(fzV5Transform); 00877 00878 // define the free zone definition 00879 AF2FreeZoneDef* freeZoneDef = 00880 new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms); 00881 00882 // define the new vertices that the rule would create and assemble them 00883 // into a list 00884 std::list<const AF2RuleNewVertex*> newVertices; 00885 AF2Point2D nvRefPoint(0.5, 0.866); 00886 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform)); 00887 00888 // define the new edges and assemble them into a list 00889 std::list<const AF2RuleNewEdge*> newEdges; 00890 newEdges.push_back(new AF2RuleNewEdge(0, 3)); 00891 newEdges.push_back(new AF2RuleNewEdge(3, 2)); 00892 00893 // define the new triangles and assemble them into a list 00894 std::list<const AF2RuleNewFace*> newTriangles; 00895 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 3)); 00896 newTriangles.push_back(new AF2RuleNewTriangle(1, 2, 3)); 00897 00898 // construct the rule itself 00899 AF2Rule* rule = 00900 new AF2Rule("Angle at Right Vertex of 120 Degrees", 1u, existVertices, 00901 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 00902 00903 // delete transforms that were allocated with new but cloned when 00904 // made part of the rule definition 00905 delete translateToHighRight; 00906 delete baseXTransform; 00907 delete noTransform; 00908 delete fzV5Transform; 00909 delete fzV4Transform; 00910 delete fzV3Transform; 00911 delete newVertexTransform; 00912 00913 return rule; 00914 } 00915 00916 const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleLeftRule() const 00917 { 00918 // define the vertices that must exist 00919 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 00920 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 00921 const AF2RuleExistVertex* highLeftExist = 00922 new AF2RuleExistVertex(-0.5, 0.866); 00923 00924 // assemble the vertices that must exist into a list 00925 std::list<const AF2RuleExistVertex*> existVertices; 00926 existVertices.push_back(originExist); 00927 existVertices.push_back(baseExist); 00928 existVertices.push_back(highLeftExist); 00929 00930 // define the baseline edge that must exist 00931 const AF2RuleExistEdge* baseEdge = 00932 new AF2RuleExistEdge(originExist, baseExist); 00933 00934 // define the other edges that must exist and assemble them into a list 00935 std::list<const AF2RuleExistEdge*> existEdges; 00936 existEdges.push_back(new AF2RuleExistEdge(highLeftExist, originExist)); 00937 00938 // define a linear point transformation that depends on 00939 // the base vertex and highLeft vertex 00940 std::list<const AF2RuleExistVertex*> t0VertexList; 00941 std::list<double> t0XCoeffList; 00942 std::list<double> t0YCoeffList; 00943 00944 t0VertexList.push_back(baseExist); 00945 t0VertexList.push_back(highLeftExist); 00946 t0XCoeffList.push_back(1.0); 00947 t0XCoeffList.push_back(0.0); 00948 t0XCoeffList.push_back(1.0); 00949 t0XCoeffList.push_back(0.0); 00950 t0YCoeffList.push_back(0.0); 00951 t0YCoeffList.push_back(1.0); 00952 t0YCoeffList.push_back(0.0); 00953 t0YCoeffList.push_back(1.0); 00954 00955 AF2PointTransform* newVertexTransform = 00956 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 00957 00958 // define another linear point transformation that depends on 00959 // the base vertex and highLeft vertex 00960 std::list<const AF2RuleExistVertex*> t1VertexList; 00961 std::list<double> t1XCoeffList; 00962 std::list<double> t1YCoeffList; 00963 00964 t1VertexList.push_back(baseExist); 00965 t1VertexList.push_back(highLeftExist); 00966 t1XCoeffList.push_back(2.0); 00967 t1XCoeffList.push_back(0.0); 00968 t1XCoeffList.push_back(1.0); 00969 t1XCoeffList.push_back(0.0); 00970 t1YCoeffList.push_back(0.0); 00971 t1YCoeffList.push_back(2.0); 00972 t1YCoeffList.push_back(0.0); 00973 t1YCoeffList.push_back(1.0); 00974 00975 AF2PointTransform* fzV2Transform = 00976 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 00977 00978 // define a third linear point transformation that depends on 00979 // the base vertex and highLeft vertex 00980 std::list<const AF2RuleExistVertex*> t2VertexList; 00981 std::list<double> t2XCoeffList; 00982 std::list<double> t2YCoeffList; 00983 00984 t2VertexList.push_back(baseExist); 00985 t2VertexList.push_back(highLeftExist); 00986 t2XCoeffList.push_back(2.0); 00987 t2XCoeffList.push_back(0.0); 00988 t2XCoeffList.push_back(2.0); 00989 t2XCoeffList.push_back(0.0); 00990 t2YCoeffList.push_back(0.0); 00991 t2YCoeffList.push_back(2.0); 00992 t2YCoeffList.push_back(0.0); 00993 t2YCoeffList.push_back(2.0); 00994 00995 AF2PointTransform* fzV3Transform = 00996 new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList); 00997 00998 // define a fourth linear point transformation that depends on 00999 // the base vertex and highLeft vertex 01000 std::list<const AF2RuleExistVertex*> t3VertexList; 01001 std::list<double> t3XCoeffList; 01002 std::list<double> t3YCoeffList; 01003 01004 t3VertexList.push_back(baseExist); 01005 t3VertexList.push_back(highLeftExist); 01006 t3XCoeffList.push_back(1.0); 01007 t3XCoeffList.push_back(0.0); 01008 t3XCoeffList.push_back(2.0); 01009 t3XCoeffList.push_back(0.0); 01010 t3YCoeffList.push_back(0.0); 01011 t3YCoeffList.push_back(1.0); 01012 t3YCoeffList.push_back(0.0); 01013 t3YCoeffList.push_back(2.0); 01014 01015 AF2PointTransform* fzV4Transform = 01016 new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList); 01017 01018 // define the reference boundary points of the free zone 01019 // and assemble them into a list 01020 std::list<AF2Point2D> fzBndryPnts; 01021 double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5}; 01022 double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866}; 01023 for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi) 01024 { 01025 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 01026 fzBndryPnts.push_back(bndryPnt); 01027 } 01028 01029 // define the point transforms that apply to the boundary points 01030 // of the free zone and assemble them into a list 01031 std::list<const AF2PointTransform*> fzBndryTrnsfrms; 01032 AF2PointTransform* noTransform = new AF2PointTransformNone(); 01033 AF2PointTransform* baseXTransform = 01034 makeLinearTransformX(baseExist, 1.0); 01035 AF2PointTransform* translateToHighLeft = makeTranslation(highLeftExist); 01036 fzBndryTrnsfrms.push_back(noTransform); 01037 fzBndryTrnsfrms.push_back(baseXTransform); 01038 fzBndryTrnsfrms.push_back(fzV2Transform); 01039 fzBndryTrnsfrms.push_back(fzV3Transform); 01040 fzBndryTrnsfrms.push_back(fzV4Transform); 01041 fzBndryTrnsfrms.push_back(translateToHighLeft); 01042 01043 // define the free zone definition 01044 AF2FreeZoneDef* freeZoneDef = 01045 new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms); 01046 01047 // define the new vertices that the rule would create and assemble them 01048 // into a list 01049 std::list<const AF2RuleNewVertex*> newVertices; 01050 AF2Point2D nvRefPoint(0.5, 0.866); 01051 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform)); 01052 01053 // define the new edges and assemble them into a list 01054 std::list<const AF2RuleNewEdge*> newEdges; 01055 newEdges.push_back(new AF2RuleNewEdge(2, 3)); 01056 newEdges.push_back(new AF2RuleNewEdge(3, 1)); 01057 01058 // define the new triangles and assemble them into a list 01059 std::list<const AF2RuleNewFace*> newTriangles; 01060 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 3)); 01061 newTriangles.push_back(new AF2RuleNewTriangle(0, 3, 2)); 01062 01063 // construct the rule itself 01064 AF2Rule* rule = 01065 new AF2Rule("Angle at Left Vertex of 120 Degrees", 1u, existVertices, 01066 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 01067 01068 // delete transforms that were allocated with new but cloned when 01069 // made part of the rule definition 01070 delete translateToHighLeft; 01071 delete baseXTransform; 01072 delete noTransform; 01073 delete fzV4Transform; 01074 delete fzV3Transform; 01075 delete fzV2Transform; 01076 delete newVertexTransform; 01077 01078 return rule; 01079 } 01080 01081 const AF2Rule* AF2DfltTriangleRules::make120DegreeAngleBothRule() const 01082 { 01083 // define the vertices that must exist 01084 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 01085 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 01086 const AF2RuleExistVertex* highLeftExist = 01087 new AF2RuleExistVertex(-0.5, 0.866); 01088 const AF2RuleExistVertex* highRightExist = 01089 new AF2RuleExistVertex(1.5, 0.866); 01090 01091 // assemble the vertices that must exist into a list 01092 std::list<const AF2RuleExistVertex*> existVertices; 01093 existVertices.push_back(originExist); 01094 existVertices.push_back(baseExist); 01095 existVertices.push_back(highLeftExist); 01096 existVertices.push_back(highRightExist); 01097 01098 // define the baseline edge that must exist 01099 const AF2RuleExistEdge* baseEdge = 01100 new AF2RuleExistEdge(originExist, baseExist); 01101 01102 // define the other edges that must exist and assemble them into a list 01103 std::list<const AF2RuleExistEdge*> existEdges; 01104 existEdges.push_back(new AF2RuleExistEdge(highLeftExist, originExist)); 01105 existEdges.push_back(new AF2RuleExistEdge(baseExist, highRightExist)); 01106 01107 // define a linear point transformation that translates along the vector 01108 // from the reference location to the bound value location of the 01109 // midpoint between the highLeft and highRight vertices 01110 std::list<const AF2RuleExistVertex*> t0VertexList; 01111 std::list<double> t0XCoeffList; 01112 std::list<double> t0YCoeffList; 01113 01114 t0VertexList.push_back(highLeftExist); 01115 t0VertexList.push_back(highRightExist); 01116 t0XCoeffList.push_back(0.5); 01117 t0XCoeffList.push_back(0.0); 01118 t0XCoeffList.push_back(0.5); 01119 t0XCoeffList.push_back(0.0); 01120 t0YCoeffList.push_back(0.0); 01121 t0YCoeffList.push_back(0.5); 01122 t0YCoeffList.push_back(0.0); 01123 t0YCoeffList.push_back(0.5); 01124 01125 AF2PointTransform* newVertexTransform = 01126 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 01127 01128 // define a linear point transformation that depends on 01129 // the base vertex, the highLeft vertex, and the highRight vertex 01130 std::list<const AF2RuleExistVertex*> t1VertexList; 01131 std::list<double> t1XCoeffList; 01132 std::list<double> t1YCoeffList; 01133 01134 t1VertexList.push_back(baseExist); 01135 t1VertexList.push_back(highLeftExist); 01136 t1VertexList.push_back(highRightExist); 01137 t1XCoeffList.push_back(-0.5); 01138 t1XCoeffList.push_back(0.0); 01139 t1XCoeffList.push_back(0.375); 01140 t1XCoeffList.push_back(0.0); 01141 t1XCoeffList.push_back(1.125); 01142 t1XCoeffList.push_back(0.0); 01143 t1YCoeffList.push_back(0.0); 01144 t1YCoeffList.push_back(-0.5); 01145 t1YCoeffList.push_back(0.0); 01146 t1YCoeffList.push_back(0.375); 01147 t1YCoeffList.push_back(0.0); 01148 t1YCoeffList.push_back(1.125); 01149 01150 AF2PointTransform* fzV3Transform = 01151 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 01152 01153 // define a linear point transformation that depends on only 01154 // the highLeft vertex and the highRight vertex 01155 std::list<const AF2RuleExistVertex*> t2VertexList; 01156 std::list<double> t2XCoeffList; 01157 std::list<double> t2YCoeffList; 01158 01159 t2VertexList.push_back(highLeftExist); 01160 t2VertexList.push_back(highRightExist); 01161 t2XCoeffList.push_back(1.125); 01162 t2XCoeffList.push_back(0.0); 01163 t2XCoeffList.push_back(0.375); 01164 t2XCoeffList.push_back(0.0); 01165 t2YCoeffList.push_back(0.0); 01166 t2YCoeffList.push_back(1.125); 01167 t2YCoeffList.push_back(0.0); 01168 t2YCoeffList.push_back(0.375); 01169 01170 AF2PointTransform* fzV4Transform = 01171 new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList); 01172 01173 // define the reference boundary points of the free zone 01174 // and assemble them into a list 01175 std::list<AF2Point2D> fzBndryPnts; 01176 double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5}; 01177 double prefYCoord[6] = {0.0, 0.0, 0.866, 1.299, 1.299, 0.866}; 01178 for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi) 01179 { 01180 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 01181 fzBndryPnts.push_back(bndryPnt); 01182 } 01183 01184 // define the point transforms that apply to the boundary points 01185 // of the free zone and assemble them into a list 01186 std::list<const AF2PointTransform*> fzBndryTrnsfrms; 01187 AF2PointTransform* noTransform = new AF2PointTransformNone(); 01188 AF2PointTransform* baseXTransform = 01189 makeLinearTransformX(baseExist, 1.0); 01190 AF2PointTransform* translateToHighRight = makeTranslation(highRightExist); 01191 AF2PointTransform* translateToHighLeft = makeTranslation(highLeftExist); 01192 fzBndryTrnsfrms.push_back(noTransform); 01193 fzBndryTrnsfrms.push_back(baseXTransform); 01194 fzBndryTrnsfrms.push_back(translateToHighRight); 01195 fzBndryTrnsfrms.push_back(fzV3Transform); 01196 fzBndryTrnsfrms.push_back(fzV4Transform); 01197 fzBndryTrnsfrms.push_back(translateToHighLeft); 01198 01199 // define the free zone definition 01200 AF2FreeZoneDef* freeZoneDef = 01201 new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms); 01202 01203 // define the new vertices that the rule would create and assemble them 01204 // into a list 01205 std::list<const AF2RuleNewVertex*> newVertices; 01206 AF2Point2D nvRefPoint(0.5, 0.866); 01207 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform)); 01208 01209 // define the new edges and assemble them into a list 01210 std::list<const AF2RuleNewEdge*> newEdges; 01211 newEdges.push_back(new AF2RuleNewEdge(2, 4)); 01212 newEdges.push_back(new AF2RuleNewEdge(4, 3)); 01213 01214 // define the new triangles and assemble them into a list 01215 std::list<const AF2RuleNewFace*> newTriangles; 01216 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 4)); 01217 newTriangles.push_back(new AF2RuleNewTriangle(0, 4, 2)); 01218 newTriangles.push_back(new AF2RuleNewTriangle(1, 3, 4)); 01219 01220 // construct the rule itself 01221 AF2Rule* rule = 01222 new AF2Rule("Angles at Both Vertices of 120 Degrees", 1u, existVertices, 01223 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 01224 01225 // delete transforms that were allocated with new but cloned when 01226 // made part of the rule definition 01227 delete translateToHighLeft; 01228 delete translateToHighRight; 01229 delete baseXTransform; 01230 delete noTransform; 01231 delete fzV4Transform; 01232 delete fzV3Transform; 01233 delete newVertexTransform; 01234 01235 return rule; 01236 } 01237 01238 const AF2Rule* AF2DfltTriangleRules::makeFillTriangleRule() const 01239 { 01240 // define the vertices that must exist 01241 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 01242 const AF2RuleExistVertex* baseExist = 01243 new AF2RuleExistVertex(1.0, 0.0, 0.5, 0.0, 0.5); 01244 const AF2RuleExistVertex* peakExist = 01245 new AF2RuleExistVertex(0.5, 0.866, 0.25, 0.0, 0.25); 01246 01247 // assemble the vertices that must exist into a list 01248 std::list<const AF2RuleExistVertex*> existVertices; 01249 existVertices.push_back(originExist); 01250 existVertices.push_back(baseExist); 01251 existVertices.push_back(peakExist); 01252 01253 // define the baseline edge that must exist 01254 const AF2RuleExistEdge* baseEdge = 01255 new AF2RuleExistEdge(originExist, baseExist); 01256 01257 // define the other edges that must exist and assemble them into a list 01258 std::list<const AF2RuleExistEdge*> existEdges; 01259 existEdges.push_back(new AF2RuleExistEdge(baseExist, peakExist)); 01260 existEdges.push_back(new AF2RuleExistEdge(peakExist, originExist)); 01261 01262 // define the reference boundary points of the free zone 01263 // and assemble them into a list 01264 std::list<AF2Point2D> fzBndryPnts; 01265 double prefXCoord[3] = {0.0, 1.0, 0.5}; 01266 double prefYCoord[3] = {0.0, 0.0, 0.866}; 01267 for (unsigned int pbpi = 0u; pbpi < 3u; ++pbpi) 01268 { 01269 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 01270 fzBndryPnts.push_back(bndryPnt); 01271 } 01272 01273 // define the point transforms that apply to the boundary points 01274 // of the free zone and assemble them into a list 01275 std::list<const AF2PointTransform*> fzBndryTrnsfrms; 01276 AF2PointTransform* noTransform = new AF2PointTransformNone(); 01277 AF2PointTransform* baseTransform = makeTranslation(baseExist); 01278 AF2PointTransform* translateToPeak = makeTranslation(peakExist); 01279 fzBndryTrnsfrms.push_back(noTransform); 01280 fzBndryTrnsfrms.push_back(baseTransform); 01281 fzBndryTrnsfrms.push_back(translateToPeak); 01282 01283 // define the free zone definition 01284 AF2FreeZoneDef* freeZoneDef = 01285 new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms); 01286 01287 // define the new vertices that the rule would create and assemble them 01288 // into a list 01289 std::list<const AF2RuleNewVertex*> newVertices; 01290 01291 // define the new edges and assemble them into a list 01292 std::list<const AF2RuleNewEdge*> newEdges; 01293 01294 // define the new triangles and assemble them into a list 01295 std::list<const AF2RuleNewFace*> newTriangles; 01296 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 01297 01298 // construct the rule itself 01299 AF2Rule* rule = 01300 new AF2Rule("Fill Triangle", 1u, existVertices, 01301 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 01302 01303 // delete transforms that were allocated with new but cloned when 01304 // made part of the rule definition 01305 delete translateToPeak; 01306 delete baseTransform; 01307 delete noTransform; 01308 01309 return rule; 01310 } 01311 01312 const AF2Rule* AF2DfltTriangleRules::makeConnectVertexRule() const 01313 { 01314 // define the vertices that must exist 01315 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 01316 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 01317 const AF2RuleExistVertex* peakExist = new AF2RuleExistVertex(0.5, 0.866); 01318 01319 // assemble the vertices that must exist into a list 01320 std::list<const AF2RuleExistVertex*> existVertices; 01321 existVertices.push_back(originExist); 01322 existVertices.push_back(baseExist); 01323 existVertices.push_back(peakExist); 01324 01325 // define the baseline edge that must exist 01326 const AF2RuleExistEdge* baseEdge = 01327 new AF2RuleExistEdge(originExist, baseExist); 01328 01329 // define the other edges that must exist and assemble them into a list 01330 std::list<const AF2RuleExistEdge*> existEdges; 01331 01332 // define a linear point transformation that balances the bound 01333 // value of the base vertex and the peak vertex 01334 std::list<const AF2RuleExistVertex*> t0VertexList; 01335 std::list<double> t0XCoeffList; 01336 std::list<double> t0YCoeffList; 01337 01338 t0VertexList.push_back(baseExist); 01339 t0VertexList.push_back(peakExist); 01340 t0XCoeffList.push_back(0.8); 01341 t0XCoeffList.push_back(0.0); 01342 t0XCoeffList.push_back(0.8); 01343 t0XCoeffList.push_back(0.0); 01344 t0YCoeffList.push_back(0.0); 01345 t0YCoeffList.push_back(0.8); 01346 t0YCoeffList.push_back(0.0); 01347 t0YCoeffList.push_back(0.8); 01348 01349 AF2PointTransform* prefV2Transform = 01350 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 01351 01352 // define another linear point transformation that balances the bound 01353 // value of the base vertex and the peak vertex 01354 std::list<const AF2RuleExistVertex*> t1VertexList; 01355 std::list<double> t1XCoeffList; 01356 std::list<double> t1YCoeffList; 01357 01358 t1VertexList.push_back(baseExist); 01359 t1VertexList.push_back(peakExist); 01360 t1XCoeffList.push_back(-0.6); 01361 t1XCoeffList.push_back(0.0); 01362 t1XCoeffList.push_back(0.8); 01363 t1XCoeffList.push_back(0.0); 01364 t1YCoeffList.push_back(0.0); 01365 t1YCoeffList.push_back(-0.6); 01366 t1YCoeffList.push_back(0.0); 01367 t1YCoeffList.push_back(0.8); 01368 01369 AF2PointTransform* prefV4Transform = 01370 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 01371 01372 // define a linear point transformation that translates along a 01373 // vector from the reference location to the bound value location 01374 // of the midpoint between the base vertex and peak vertex 01375 std::list<const AF2RuleExistVertex*> t2VertexList; 01376 std::list<double> t2XCoeffList; 01377 std::list<double> t2YCoeffList; 01378 01379 t2VertexList.push_back(baseExist); 01380 t2VertexList.push_back(peakExist); 01381 t2XCoeffList.push_back(0.5); 01382 t2XCoeffList.push_back(0.0); 01383 t2XCoeffList.push_back(0.5); 01384 t2XCoeffList.push_back(0.0); 01385 t2YCoeffList.push_back(0.0); 01386 t2YCoeffList.push_back(0.5); 01387 t2YCoeffList.push_back(0.0); 01388 t2YCoeffList.push_back(0.5); 01389 01390 AF2PointTransform* limV2Transform = 01391 new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList); 01392 01393 // define a linear point transformation that translates along a 01394 // vector from the reference location to the bound value location 01395 // of the midpoint between the origin vertex and peak vertex 01396 // (assuming the origin vertex is bound at (0, 0)) 01397 std::list<const AF2RuleExistVertex*> t3VertexList; 01398 std::list<double> t3XCoeffList; 01399 std::list<double> t3YCoeffList; 01400 01401 t3VertexList.push_back(peakExist); 01402 t3XCoeffList.push_back(0.5); 01403 t3XCoeffList.push_back(0.0); 01404 t3YCoeffList.push_back(0.0); 01405 t3YCoeffList.push_back(0.5); 01406 01407 AF2PointTransform* limV4Transform = 01408 new AF2PntTrnsfrmLnrV(t3VertexList, t3XCoeffList, t3YCoeffList); 01409 01410 // define the reference preferred boundary points of the free zone 01411 // and assemble them into a list 01412 std::list<AF2Point2D> prefBndryPnts; 01413 double prefXCoord[5] = {0.0, 1.0, 1.2, 0.5, -0.2}; 01414 double prefYCoord[5] = {0.0, 0.0, 0.693, 0.866, 0.693}; 01415 for (unsigned int pbpi = 0u; pbpi < 5u; ++pbpi) 01416 { 01417 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 01418 prefBndryPnts.push_back(bndryPnt); 01419 } 01420 01421 // define the point transforms that apply to the preferred 01422 // boundary points of the free zone and assemble them into a list 01423 std::list<const AF2PointTransform*> prefBndryTrnsfrms; 01424 AF2PointTransform* noTransform = new AF2PointTransformNone(); 01425 AF2PointTransform* baseTransform = makeTranslation(baseExist); 01426 AF2PointTransform* translateToPeak = makeTranslation(peakExist); 01427 prefBndryTrnsfrms.push_back(noTransform); 01428 prefBndryTrnsfrms.push_back(baseTransform); 01429 prefBndryTrnsfrms.push_back(prefV2Transform); 01430 prefBndryTrnsfrms.push_back(translateToPeak); 01431 prefBndryTrnsfrms.push_back(prefV4Transform); 01432 01433 // define the reference limiting boundary points of the free zone 01434 // and assemble them into a list 01435 std::list<AF2Point2D> limBndryPnts; 01436 double limXCoord[5] = {0.0, 1.0, 0.75, 0.5, 0.25}; 01437 double limYCoord[5] = {0.0, 0.0, 0.433, 0.866, 0.433}; 01438 for (unsigned int lbpi = 0u; lbpi < 5u; ++lbpi) 01439 { 01440 AF2Point2D bndryPnt(limXCoord[lbpi], limYCoord[lbpi]); 01441 limBndryPnts.push_back(bndryPnt); 01442 } 01443 01444 // define the point transforms that apply to the limiting 01445 // boundary points of the free zone and assemble them into a list 01446 std::list<const AF2PointTransform*> limBndryTrnsfrms; 01447 limBndryTrnsfrms.push_back(noTransform); 01448 limBndryTrnsfrms.push_back(baseTransform); 01449 limBndryTrnsfrms.push_back(limV2Transform); 01450 limBndryTrnsfrms.push_back(translateToPeak); 01451 limBndryTrnsfrms.push_back(limV4Transform); 01452 01453 // define the free zone definition 01454 AF2FreeZoneDef* freeZoneDef = new AF2FreeZoneDefLCQualLim(prefBndryPnts, 01455 prefBndryTrnsfrms, limBndryPnts, limBndryTrnsfrms); 01456 01457 // define the new vertices that the rule would create and assemble them 01458 // into a list 01459 std::list<const AF2RuleNewVertex*> newVertices; 01460 01461 // define the new edges and assemble them into a list 01462 std::list<const AF2RuleNewEdge*> newEdges; 01463 newEdges.push_back(new AF2RuleNewEdge(0, 2)); 01464 newEdges.push_back(new AF2RuleNewEdge(2, 1)); 01465 01466 // define the new triangles and assemble them into a list 01467 std::list<const AF2RuleNewFace*> newTriangles; 01468 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 2)); 01469 01470 // construct the rule itself 01471 AF2Rule* rule = 01472 new AF2Rule("Connect to Opposite Vertex", 1u, existVertices, 01473 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 01474 01475 // delete transforms that were allocated with new but cloned when 01476 // made part of the rule definition 01477 delete translateToPeak; 01478 delete baseTransform; 01479 delete noTransform; 01480 delete limV4Transform; 01481 delete limV2Transform; 01482 delete prefV4Transform; 01483 delete prefV2Transform; 01484 01485 return rule; 01486 } 01487 01488 const AF2Rule* AF2DfltTriangleRules::makeConnectEdgeRule() const 01489 { 01490 // define the vertices that must exist 01491 const AF2RuleExistVertex* originExist = new AF2RuleExistVertex(0.0, 0.0); 01492 const AF2RuleExistVertex* baseExist = new AF2RuleExistVertex(1.0, 0.0); 01493 const AF2RuleExistVertex* oppRightExist = new AF2RuleExistVertex(1.0, 1.732); 01494 const AF2RuleExistVertex* oppLeftExist = new AF2RuleExistVertex(0.0, 1.732); 01495 01496 // assemble the vertices that must exist into a list 01497 std::list<const AF2RuleExistVertex*> existVertices; 01498 existVertices.push_back(originExist); 01499 existVertices.push_back(baseExist); 01500 existVertices.push_back(oppRightExist); 01501 existVertices.push_back(oppLeftExist); 01502 01503 // define the baseline edge that must exist 01504 const AF2RuleExistEdge* baseEdge = 01505 new AF2RuleExistEdge(originExist, baseExist); 01506 01507 // define the other edges that must exist and assemble them into a list 01508 std::list<const AF2RuleExistEdge*> existEdges; 01509 existEdges.push_back(new AF2RuleExistEdge(oppRightExist, oppLeftExist)); 01510 01511 // define a linear point transformation that balances the bound values of 01512 // the base vertex, the opposite right vertex, and the opposite left vertex 01513 std::list<const AF2RuleExistVertex*> t0VertexList; 01514 std::list<double> t0XCoeffList; 01515 std::list<double> t0YCoeffList; 01516 01517 t0VertexList.push_back(baseExist); 01518 t0VertexList.push_back(oppRightExist); 01519 t0VertexList.push_back(oppLeftExist); 01520 t0XCoeffList.push_back(0.25); 01521 t0XCoeffList.push_back(0.0); 01522 t0XCoeffList.push_back(0.25); 01523 t0XCoeffList.push_back(0.0); 01524 t0XCoeffList.push_back(0.25); 01525 t0XCoeffList.push_back(0.0); 01526 t0YCoeffList.push_back(0.0); 01527 t0YCoeffList.push_back(0.25); 01528 t0YCoeffList.push_back(0.0); 01529 t0YCoeffList.push_back(0.25); 01530 t0YCoeffList.push_back(0.0); 01531 t0YCoeffList.push_back(0.25); 01532 01533 AF2PointTransform* newVertexTransform = 01534 new AF2PntTrnsfrmLnrV(t0VertexList, t0XCoeffList, t0YCoeffList); 01535 01536 // define another linear point transformation that balances bound values of 01537 // the base vertex, the opposite right vertex, and the opposite left vertex 01538 std::list<const AF2RuleExistVertex*> t1VertexList; 01539 std::list<double> t1XCoeffList; 01540 std::list<double> t1YCoeffList; 01541 01542 t1VertexList.push_back(baseExist); 01543 t1VertexList.push_back(oppRightExist); 01544 t1VertexList.push_back(oppLeftExist); 01545 t1XCoeffList.push_back(0.75); 01546 t1XCoeffList.push_back(0.0); 01547 t1XCoeffList.push_back(0.75); 01548 t1XCoeffList.push_back(0.0); 01549 t1XCoeffList.push_back(-0.25); 01550 t1XCoeffList.push_back(0.0); 01551 t1YCoeffList.push_back(0.0); 01552 t1YCoeffList.push_back(0.75); 01553 t1YCoeffList.push_back(0.0); 01554 t1YCoeffList.push_back(0.75); 01555 t1YCoeffList.push_back(0.0); 01556 t1YCoeffList.push_back(-0.25); 01557 01558 01559 AF2PointTransform* fzV2Transform = 01560 new AF2PntTrnsfrmLnrV(t1VertexList, t1XCoeffList, t1YCoeffList); 01561 01562 // define a third linear point transformation that balances bound values of 01563 // the base vertex, the opposite right vertex, and the opposite left vertex 01564 std::list<const AF2RuleExistVertex*> t2VertexList; 01565 std::list<double> t2XCoeffList; 01566 std::list<double> t2YCoeffList; 01567 01568 t2VertexList.push_back(baseExist); 01569 t2VertexList.push_back(oppRightExist); 01570 t2VertexList.push_back(oppLeftExist); 01571 t2XCoeffList.push_back(-0.25); 01572 t2XCoeffList.push_back(0.0); 01573 t2XCoeffList.push_back(-0.25); 01574 t2XCoeffList.push_back(0.0); 01575 t2XCoeffList.push_back(0.75); 01576 t2XCoeffList.push_back(0.0); 01577 t2YCoeffList.push_back(0.0); 01578 t2YCoeffList.push_back(-0.25); 01579 t2YCoeffList.push_back(0.0); 01580 t2YCoeffList.push_back(-0.25); 01581 t2YCoeffList.push_back(0.0); 01582 t2YCoeffList.push_back(0.75); 01583 01584 01585 AF2PointTransform* fzV5Transform = 01586 new AF2PntTrnsfrmLnrV(t2VertexList, t2XCoeffList, t2YCoeffList); 01587 01588 // define the reference boundary points of the free zone 01589 // and assemble them into a list 01590 std::list<AF2Point2D> fzBndryPnts; 01591 double prefXCoord[6] = {0.0, 1.0, 1.5, 1.0, 0.0, -0.5}; 01592 double prefYCoord[6] = {0.0, 0.0, 0.866, 1.732, 1.732, 0.866}; 01593 for (unsigned int pbpi = 0u; pbpi < 6u; ++pbpi) 01594 { 01595 AF2Point2D bndryPnt(prefXCoord[pbpi], prefYCoord[pbpi]); 01596 fzBndryPnts.push_back(bndryPnt); 01597 } 01598 01599 // define the point transforms that apply to the boundary points 01600 // of the free zone and assemble them into a list 01601 std::list<const AF2PointTransform*> fzBndryTrnsfrms; 01602 AF2PointTransform* noTransform = new AF2PointTransformNone(); 01603 AF2PointTransform* baseTransform = makeTranslation(baseExist); 01604 AF2PointTransform* translateToOppRight = makeTranslation(oppRightExist); 01605 AF2PointTransform* translateToOppLeft = makeTranslation(oppLeftExist); 01606 fzBndryTrnsfrms.push_back(noTransform); 01607 fzBndryTrnsfrms.push_back(baseTransform); 01608 fzBndryTrnsfrms.push_back(fzV2Transform); 01609 fzBndryTrnsfrms.push_back(translateToOppRight); 01610 fzBndryTrnsfrms.push_back(translateToOppLeft); 01611 fzBndryTrnsfrms.push_back(fzV5Transform); 01612 01613 // define the free zone definition 01614 AF2FreeZoneDef* freeZoneDef = 01615 new AF2FreeZoneDefSimple(fzBndryPnts, fzBndryTrnsfrms); 01616 01617 // define the new vertices that the rule would create and assemble them 01618 // into a list 01619 std::list<const AF2RuleNewVertex*> newVertices; 01620 AF2Point2D nvRefPoint(0.5, 0.866); 01621 newVertices.push_back(new AF2RuleNewVertex(nvRefPoint, newVertexTransform)); 01622 01623 // define the new edges and assemble them into a list 01624 std::list<const AF2RuleNewEdge*> newEdges; 01625 newEdges.push_back(new AF2RuleNewEdge(0, 4)); 01626 newEdges.push_back(new AF2RuleNewEdge(2, 4)); 01627 newEdges.push_back(new AF2RuleNewEdge(4, 1)); 01628 newEdges.push_back(new AF2RuleNewEdge(4, 3)); 01629 01630 // define the new triangles and assemble them into a list 01631 std::list<const AF2RuleNewFace*> newTriangles; 01632 newTriangles.push_back(new AF2RuleNewTriangle(0, 1, 4)); 01633 newTriangles.push_back(new AF2RuleNewTriangle(2, 3, 4)); 01634 01635 // construct the rule itself 01636 AF2Rule* rule = 01637 new AF2Rule("Connect to Opposite Edge", 3u, existVertices, 01638 baseEdge, existEdges, freeZoneDef, newVertices, newEdges, newTriangles); 01639 01640 // delete transforms that were allocated with new but cloned when 01641 // made part of the rule definition 01642 delete translateToOppLeft; 01643 delete translateToOppRight; 01644 delete baseTransform; 01645 delete noTransform; 01646 delete fzV5Transform; 01647 delete fzV2Transform; 01648 delete newVertexTransform; 01649 01650 return rule; 01651 }