src/editmodes/circleMode.cpp

changeset 1430
6ce6d3da584f
parent 1417
ed39bfca7a67
child 1437
1a77c6156db7
equal deleted inserted replaced
1429:80e8aaabeeed 1430:6ce6d3da584f
101 { 101 {
102 // Special case: radii are the same, there's no area. Use a circle. 102 // Special case: radii are the same, there's no area. Use a circle.
103 // transform = shearMatrixForPlane(renderer()); 103 // transform = shearMatrixForPlane(renderer());
104 QMatrix4x4 transform = renderer()->currentCamera().transformationMatrix(1); 104 QMatrix4x4 transform = renderer()->currentCamera().transformationMatrix(1);
105 transform.scale(dist0); 105 transform.scale(dist0);
106 transform.translate(translation); 106 offset(transform, translation);
107 model.emplace<LDCircularPrimitive>(PrimitiveModel::Circle, section.segments, section.divisions, transform); 107 model.emplace<LDCircularPrimitive>(PrimitiveModel::Circle, section.segments, section.divisions, transform);
108 finishDraw(model); 108 finishDraw(model);
109 return; 109 return;
110 } 110 }
111 else if (qFuzzyCompare(dist0, 0) or qFuzzyCompare(dist1, 0)) 111 else if (qFuzzyCompare(dist0, 0) or qFuzzyCompare(dist1, 0))
112 { 112 {
113 // Special case #2: one radius is 0, so use a disc. 113 // Special case #2: one radius is 0, so use a disc.
114 //transform = shearMatrixForPlane(renderer()); 114 //transform = shearMatrixForPlane(renderer());
115 QMatrix4x4 transform = renderer()->currentCamera().transformationMatrix(1); 115 QMatrix4x4 transform = renderer()->currentCamera().transformationMatrix(1);
116 transform.scale(max(dist0, dist1)); 116 transform.scale(max(dist0, dist1));
117 transform.translate(translation); 117 offset(transform, translation);
118 model.emplace<LDCircularPrimitive>(PrimitiveModel::Disc, section.segments, section.divisions, transform); 118 model.emplace<LDCircularPrimitive>(PrimitiveModel::Disc, section.segments, section.divisions, transform);
119 finishDraw(model); 119 finishDraw(model);
120 return; 120 return;
121 } 121 }
122 else if (g_RingFinder.findRings(dist0, dist1)) // Consult the ring finder now 122 else if (g_RingFinder.findRings(dist0, dist1)) // Consult the ring finder now
131 for (const RingFinder::Component& component : g_RingFinder.bestSolution()->getComponents()) 131 for (const RingFinder::Component& component : g_RingFinder.bestSolution()->getComponents())
132 { 132 {
133 primitiveModel.ringNumber = component.num; 133 primitiveModel.ringNumber = component.num;
134 LDDocument* primitiveFile = primitives()->getPrimitive(primitiveModel); 134 LDDocument* primitiveFile = primitives()->getPrimitive(primitiveModel);
135 QMatrix4x4 matrix = renderer()->currentCamera().transformationMatrix(component.scale); 135 QMatrix4x4 matrix = renderer()->currentCamera().transformationMatrix(component.scale);
136 matrix.translate(translation); 136 offset(matrix, translation);
137 // matrix = shearMatrixForPlane(renderer()) * matrix; 137 // matrix = shearMatrixForPlane(renderer()) * matrix;
138 model.emplace<LDSubfileReference>(primitiveFile->name(), matrix); 138 model.emplace<LDSubfileReference>(primitiveFile->name(), matrix);
139 } 139 }
140 } 140 }
141 else 141 else

mercurial