1419 |
1419 |
1420 if (dist1 < dist0) |
1420 if (dist1 < dist0) |
1421 std::swap<double> (dist0, dist1); |
1421 std::swap<double> (dist0, dist1); |
1422 |
1422 |
1423 if (dist0 == dist1) |
1423 if (dist0 == dist1) |
1424 { refFile = getFile ("4-4edge.dat"); |
1424 { // If the radii are the same, there's no ring space to fill. Use a circle. |
|
1425 refFile = getFile ("4-4edge.dat"); |
1425 transform = getCircleDrawMatrix (dist0); |
1426 transform = getCircleDrawMatrix (dist0); |
1426 circleOrDisc = true; |
1427 circleOrDisc = true; |
1427 } |
1428 } |
1428 elif (dist0 == 0 || dist1 == 0) |
1429 elif (dist0 == 0 || dist1 == 0) |
1429 { refFile = getFile ("4-4disc.dat"); |
1430 { // If either radii is 0, use a disc. |
|
1431 refFile = getFile ("4-4disc.dat"); |
1430 transform = getCircleDrawMatrix ((dist0 != 0) ? dist0 : dist1); |
1432 transform = getCircleDrawMatrix ((dist0 != 0) ? dist0 : dist1); |
1431 circleOrDisc = true; |
1433 circleOrDisc = true; |
1432 } |
1434 } |
1433 elif (g_RingFinder (dist0, dist1) /* && g_RingFinder.solution().size() <= 3 */) |
1435 elif (g_RingFinder (dist0, dist1)) |
1434 { for (const RingFinder::SolutionComponent& cmp : g_RingFinder.solution()) |
1436 { // The ring finder found a solution, use that. Add the component rings to the file. |
|
1437 for (const RingFinder::SolutionComponent& cmp : g_RingFinder.solution()) |
1435 { if ((refFile = getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null) |
1438 { if ((refFile = getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null) |
1436 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num); |
1439 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num); |
1437 refFile->setImplicit (false); |
1440 refFile->setImplicit (false); |
1438 } |
1441 } |
1439 |
1442 |
1446 } |
1449 } |
1447 } |
1450 } |
1448 else |
1451 else |
1449 { // Last resort: draw the ring with quads |
1452 { // Last resort: draw the ring with quads |
1450 QList<QLineF> c0, c1; |
1453 QList<QLineF> c0, c1; |
1451 |
1454 Axis relX, relY, relZ; |
|
1455 getRelativeAxes (relX, relY); |
|
1456 relZ = (Axis) (3 - relX - relY); |
|
1457 double x0 = m_drawedVerts[0][relX], |
|
1458 y0 = m_drawedVerts[0][relY]; |
|
1459 |
|
1460 vertex templ; |
|
1461 templ[relX] = x0; |
|
1462 templ[relY] = y0; |
|
1463 templ[relZ] = depthValue(); |
|
1464 |
|
1465 // Calculate circle coords |
1452 makeCircle (segs, divs, dist0, c0); |
1466 makeCircle (segs, divs, dist0, c0); |
1453 makeCircle (segs, divs, dist1, c1); |
1467 makeCircle (segs, divs, dist1, c1); |
1454 |
1468 |
1455 for (int i = 0; i < 16; ++i) |
1469 for (int i = 0; i < segs; ++i) |
1456 { |
1470 { vertex v0, v1, v2, v3; |
|
1471 v0 = v1 = v2 = v3 = templ; |
|
1472 v0[relX] += c0[i].x1(); |
|
1473 v0[relY] += c0[i].y1(); |
|
1474 v1[relX] += c0[i].x2(); |
|
1475 v1[relY] += c0[i].y2(); |
|
1476 v2[relX] += c1[i].x2(); |
|
1477 v2[relY] += c1[i].y2(); |
|
1478 v3[relX] += c1[i].x1(); |
|
1479 v3[relY] += c1[i].y1(); |
|
1480 |
|
1481 LDQuad* q = new LDQuad (v0, v1, v2, v3); |
|
1482 q->setColor (maincolor); |
|
1483 |
|
1484 // Ensure the quads always are BFC-front towards the camera |
|
1485 if (camera() % 3 <= 0) |
|
1486 q->invert(); |
|
1487 |
|
1488 objs << q; |
1457 } |
1489 } |
1458 } |
1490 } |
1459 |
1491 |
1460 if (circleOrDisc) |
1492 if (circleOrDisc) |
1461 { LDSubfile* ref = new LDSubfile; |
1493 { LDSubfile* ref = new LDSubfile; |