19 #include <QApplication> |
19 #include <QApplication> |
20 #include <QMessageBox> |
20 #include <QMessageBox> |
21 #include "lddocument.h" |
21 #include "lddocument.h" |
22 #include "mainwindow.h" |
22 #include "mainwindow.h" |
23 #include "primitives.h" |
23 #include "primitives.h" |
24 #include "miscallenous.h" |
|
25 #include "colors.h" |
24 #include "colors.h" |
26 #include "documentmanager.h" |
25 #include "documentmanager.h" |
27 #include "editHistory.h" |
26 #include "editHistory.h" |
|
27 #include "algorithms/geometry.h" |
28 #include "linetypes/comment.h" |
28 #include "linetypes/comment.h" |
29 #include "linetypes/conditionaledge.h" |
29 #include "linetypes/conditionaledge.h" |
30 #include "linetypes/edgeline.h" |
30 #include "linetypes/edgeline.h" |
31 #include "linetypes/empty.h" |
31 #include "linetypes/empty.h" |
32 #include "linetypes/quadrilateral.h" |
32 #include "linetypes/quadrilateral.h" |
370 if (segments < divisions and not conditionalLineSegments.isEmpty()) |
370 if (segments < divisions and not conditionalLineSegments.isEmpty()) |
371 conditionalLineSegments << segments; |
371 conditionalLineSegments << segments; |
372 |
372 |
373 for (int i : conditionalLineSegments) |
373 for (int i : conditionalLineSegments) |
374 { |
374 { |
375 Vertex v0 = {getRadialPoint(i, divisions, cos), 0.0f, getRadialPoint(i, divisions, sin)}; |
375 QPointF p0 = ::pointOnCircumference(i, divisions); |
|
376 QPointF p2 = ::pointOnCircumference(i + 1, divisions); |
|
377 QPointF p3 = ::pointOnCircumference(i - 1, divisions); |
|
378 Vertex v0 = {p0.x(), 0.0, p0.y()}; |
376 Vertex v1; |
379 Vertex v1; |
377 Vertex v2 = {getRadialPoint(i + 1, divisions, cos), 0.0f, getRadialPoint(i + 1, divisions, sin)}; |
380 Vertex v2 = {p2.x(), 0.0, p2.y()}; |
378 Vertex v3 = {getRadialPoint(i - 1, divisions, cos), 0.0f, getRadialPoint(i - 1, divisions, sin)}; |
381 Vertex v3 = {p3.x(), 0.0, p3.y()}; |
379 |
382 |
380 if (type == Cylinder) |
383 if (type == Cylinder) |
381 { |
384 { |
382 v1 = {v0[X], 1.0f, v0[Z]}; |
385 v1 = {v0.x, 1.0f, v0.z}; |
383 } |
386 } |
384 else if (type == Cone) |
387 else if (type == Cone) |
385 { |
388 { |
386 v1 = {v0[X] * (ringNumber + 1), 0.0, v0[Z] * (ringNumber + 1)}; |
389 v1 = {v0.x * (ringNumber + 1), 0.0, v0.z * (ringNumber + 1)}; |
387 v0 = {v0[X] * ringNumber, 1.0, v0[Z] * ringNumber}; |
390 v0 = {v0.x * ringNumber, 1.0, v0.z * ringNumber}; |
388 } |
391 } |
389 |
392 |
390 LDConditionalEdge* line = model.emplace<LDConditionalEdge>(); |
393 LDConditionalEdge* line = model.emplace<LDConditionalEdge>(); |
391 line->setColor(EdgeColor); |
394 line->setColor(EdgeColor); |
392 line->setVertex(0, v0); |
395 line->setVertex(0, v0); |