diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-11-03 00:10:02 +0000 |
| commit | d2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch) | |
| tree | e2703384779e83312c456399999997fcc289c5cf /src/live_effects/lpe-circle_3pts.cpp | |
| parent | Merge branch 'master' into powerpencil (diff) | |
| parent | change assignment to equality (diff) | |
| download | inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip | |
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/live_effects/lpe-circle_3pts.cpp')
| -rw-r--r-- | src/live_effects/lpe-circle_3pts.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/live_effects/lpe-circle_3pts.cpp b/src/live_effects/lpe-circle_3pts.cpp index 3410b13f2..c49d5ca4d 100644 --- a/src/live_effects/lpe-circle_3pts.cpp +++ b/src/live_effects/lpe-circle_3pts.cpp @@ -40,12 +40,18 @@ static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point con Point v = (B - A).ccw(); Point w = (C - B).ccw(); + double det = -v[0] * w[1] + v[1] * w[0]; - Point F = E - D; - double lambda = 1/det * (-w[1] * F[0] + w[0] * F[1]); + Point M; + if (!v.isZero()) { + Point F = E - D; + double lambda = det == 0 ? 0 : (-w[1] * F[0] + w[0] * F[1]) / det; + M = D + v * lambda; + } else { + M = E; + } - Point M = D + v * lambda; double radius = L2(M - A); Geom::Circle c(M, radius); |
