1431 circleOrDisc = true; |
1431 circleOrDisc = true; |
1432 } |
1432 } |
1433 elif (g_RingFinder (dist0, dist1)) |
1433 elif (g_RingFinder (dist0, dist1)) |
1434 { // The ring finder found a solution, use that. Add the component rings to the file. |
1434 { // The ring finder found a solution, use that. Add the component rings to the file. |
1435 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) |
1435 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) |
1436 { if ((refFile = ::getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null) |
1436 { // Get a ref file for this primitive. If we cannot find it in the |
|
1437 // LDraw library, generate it. |
|
1438 if ((refFile = ::getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null) |
1437 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num); |
1439 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num); |
1438 refFile->setImplicit (false); |
1440 refFile->setImplicit (false); |
1439 } |
1441 } |
1440 |
1442 |
1441 LDSubfile* ref = new LDSubfile; |
1443 LDSubfile* ref = new LDSubfile; |
1445 ref->setColor (maincolor); |
1447 ref->setColor (maincolor); |
1446 objs << ref; |
1448 objs << ref; |
1447 } |
1449 } |
1448 } |
1450 } |
1449 else |
1451 else |
1450 { // Last resort: draw the ring with quads |
1452 { // Ring finder failed, last resort: draw the ring with quads |
1451 QList<QLineF> c0, c1; |
1453 QList<QLineF> c0, c1; |
1452 Axis relX, relY, relZ; |
1454 Axis relX, relY, relZ; |
1453 getRelativeAxes (relX, relY); |
1455 getRelativeAxes (relX, relY); |
1454 relZ = (Axis) (3 - relX - relY); |
1456 relZ = (Axis) (3 - relX - relY); |
1455 double x0 = m_drawedVerts[0][relX], |
1457 double x0 = m_drawedVerts[0][relX], |