62
62
0.5 * (iV[0] + iV[1]), 0.5 * (iV[1] - iV[0]).Len());
65
IpeLine l1(iV[0], (iV[1] - iV[0]).Normalized());
66
65
if (iCur == 1 || iV[1] == iV[2] ) {
67
66
return IpePath(iServices->OvSvcAttributes(),
68
67
0.5 * (iV[0] + iV[1]), 0.5 * (iV[1] - iV[0]).Len());
69
} else if (IpeAbs(l1.Side(iV[2])) < 1e-9) {
70
// Argh. We really need an eps here!
71
return IpePath(iServices->OvSvcAttributes(),
72
IpeSegment(iV[0], iV[2]));
74
IpeLine l1(iV[0], iV[1] - iV[0]);
75
IpeLine l2(iV[1], iV[2] - iV[1]);
76
IpeLine bi1(0.5 * (iV[0] + iV[1]), l1.Normal().Normalized());
77
IpeLine bi2(0.5 * (iV[1] + iV[2]), l2.Normal().Normalized());
79
bi1.Intersects(bi2, center);
80
return IpePath(iServices->OvSvcAttributes(), center,
81
(iV[0] - center).Len());
69
IpeLine l1(iV[0], (iV[1] - iV[0]).Normalized());
70
if (IpeAbs(l1.Side(iV[2])) < 1e-9) {
71
// Argh. We really need an eps here!
72
return IpePath(iServices->OvSvcAttributes(),
73
IpeSegment(iV[0], iV[2]));
75
IpeLine l2(iV[1], (iV[2] - iV[1]).Normalized());
76
IpeLine bi1(0.5 * (iV[0] + iV[1]), l1.Normal().Normalized());
77
IpeLine bi2(0.5 * (iV[1] + iV[2]), l2.Normal().Normalized());
79
bi1.Intersects(bi2, center);
80
return IpePath(iServices->OvSvcAttributes(), center,
81
(iV[0] - center).Len());
102
103
void IpeCreateCircle::MousePress(QMouseEvent *)
105
// refuse point identical to previous
106
if (iCanvas->Pos() == iV[iCur - 1])
104
109
iV[iCur++] = iCanvas->Pos();
105
110
if (iCur == 3 || iMode != E3Points && iCur == 2) {
107
112
IpePath *obj = new IpePath(Create());
108
113
iServices->OvSvcAddObject(obj);
109
114
iCanvas->FinishOverlay();
116
iV[iCur] = iCanvas->Pos();
111
117
iCanvas->UpdateOverlay();
114
121
// --------------------------------------------------------------------