69 } |
69 } |
70 |
70 |
71 void CircleMode::buildCircle() |
71 void CircleMode::buildCircle() |
72 { |
72 { |
73 LDObjectList objs; |
73 LDObjectList objs; |
74 const int segs = g_lores, divs = g_lores; // TODO: make customizable |
74 const int segs = LowResolution, divs = LowResolution; // TODO: make customizable |
75 double dist0 = getCircleDrawDist (0), |
75 double dist0 = getCircleDrawDist (0), |
76 dist1 = getCircleDrawDist (1); |
76 dist1 = getCircleDrawDist (1); |
77 LDDocumentPtr refFile; |
77 LDDocumentPtr refFile; |
78 Matrix transform; |
78 Matrix transform; |
79 bool circleOrDisc = false; |
79 bool circleOrDisc = false; |
100 // The ring finder found a solution, use that. Add the component rings to the file. |
100 // The ring finder found a solution, use that. Add the component rings to the file. |
101 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) |
101 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) |
102 { |
102 { |
103 // Get a ref file for this primitive. If we cannot find it in the |
103 // Get a ref file for this primitive. If we cannot find it in the |
104 // LDraw library, generate it. |
104 // LDraw library, generate it. |
105 if ((refFile = ::getDocument (radialFileName (::Ring, g_lores, g_lores, cmp.num))) == null) |
105 if ((refFile = ::getDocument (radialFileName (::Ring, LowResolution, LowResolution, |
|
106 cmp.num))) == null) |
106 { |
107 { |
107 refFile = generatePrimitive (::Ring, g_lores, g_lores, cmp.num); |
108 refFile = generatePrimitive (::Ring, LowResolution, LowResolution, cmp.num); |
108 refFile->setImplicit (false); |
109 refFile->setImplicit (false); |
109 } |
110 } |
110 |
111 |
111 LDSubfilePtr ref = spawn<LDSubfile>(); |
112 LDSubfilePtr ref = spawn<LDSubfile>(); |
112 ref->setFileInfo (refFile); |
113 ref->setFileInfo (refFile); |
184 else |
185 else |
185 { |
186 { |
186 QVector<Vertex> verts, verts2; |
187 QVector<Vertex> verts, verts2; |
187 const double dist0 = getCircleDrawDist (0), |
188 const double dist0 = getCircleDrawDist (0), |
188 dist1 = (_drawedVerts.size() >= 2) ? getCircleDrawDist (1) : -1; |
189 dist1 = (_drawedVerts.size() >= 2) ? getCircleDrawDist (1) : -1; |
189 const int segs = g_lores; |
190 const int segs = LowResolution; |
190 const double angleUnit = (2 * pi) / segs; |
191 const double angleUnit = (2 * pi) / segs; |
191 Axis relX, relY; |
192 Axis relX, relY; |
192 QVector<QPoint> ringpoints, circlepoints, circle2points; |
193 QVector<QPoint> ringpoints, circlepoints, circle2points; |
193 |
194 |
194 renderer()->getRelativeAxes (relX, relY); |
195 renderer()->getRelativeAxes (relX, relY); |