204 QLineF bearing (originspot, renderer()->mousePositionF()); |
204 QLineF bearing (originspot, renderer()->mousePositionF()); |
205 QLineF bearing2 (originspot, QPointF (originspot.x(), 0.0)); |
205 QLineF bearing2 (originspot, QPointF (originspot.x(), 0.0)); |
206 double angleoffset (-bearing.angleTo (bearing2) + 90); |
206 double angleoffset (-bearing.angleTo (bearing2) + 90); |
207 angleoffset /= (360.0 / divisions); // convert angle to 0-16 scale |
207 angleoffset /= (360.0 / divisions); // convert angle to 0-16 scale |
208 angleoffset = round (angleoffset); // round to nearest 16th |
208 angleoffset = round (angleoffset); // round to nearest 16th |
209 angleoffset *= ((2 * Pi) / divisions); // convert to radians |
209 angleoffset *= ((2 * pi) / divisions); // convert to radians |
210 angleoffset *= renderer()->depthNegateFactor(); // negate based on camera |
210 angleoffset *= renderer()->depthNegateFactor(); // negate based on camera |
211 return angleoffset; |
211 return angleoffset; |
212 } |
212 } |
213 |
213 |
214 void CircleMode::render (QPainter& painter) const |
214 void CircleMode::render (QPainter& painter) const |
228 QVector<QPointF> innerverts2d, outerverts2d; |
228 QVector<QPointF> innerverts2d, outerverts2d; |
229 const double innerdistance (getCircleDrawDist (0)); |
229 const double innerdistance (getCircleDrawDist (0)); |
230 const double outerdistance (m_drawedVerts.size() >= 2 ? getCircleDrawDist (1) : -1); |
230 const double outerdistance (m_drawedVerts.size() >= 2 ? getCircleDrawDist (1) : -1); |
231 const int divisions (m_window->ringToolHiRes() ? HighResolution : LowResolution); |
231 const int divisions (m_window->ringToolHiRes() ? HighResolution : LowResolution); |
232 const int segments (m_window->ringToolSegments()); |
232 const int segments (m_window->ringToolSegments()); |
233 const double angleUnit (2 * Pi / divisions); |
233 const double angleUnit (2 * pi / divisions); |
234 Axis relX, relY; |
234 Axis relX, relY; |
235 renderer()->getRelativeAxes (relX, relY); |
235 renderer()->getRelativeAxes (relX, relY); |
236 const double angleoffset (m_drawedVerts.size() < 3 ? getAngleOffset() : m_angleOffset); |
236 const double angleoffset (m_drawedVerts.size() < 3 ? getAngleOffset() : m_angleOffset); |
237 |
237 |
238 // Calculate the preview positions of vertices |
238 // Calculate the preview positions of vertices |