Skip to content

Commit

Permalink
[giac] fix circle intersection
Browse files Browse the repository at this point in the history
c1:=circle(0,5);c2:=circle(4,10);C:=inter(c1,c2);


git-svn-id: https://dev.geogebra.org/svn/trunk/geogebra/giac@70048 23ce0884-8a58-47d3-bc5c-ddf1cd5b9f9e
  • Loading branch information
bernard.parisse committed Oct 30, 2022
1 parent 2c39c23 commit dae6aff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/giac/cpp/plot.cc
Expand Up @@ -9719,7 +9719,10 @@ namespace giac {
// delta=ra^2-rb^2+AB^2
gen delta=rayon_a2-rayon_b2+ab2;
gen ab4=centre_a+delta/2/ab2*ab;
gen d_perp(sqrt(4*ab2*rayon_a2-pow(delta,2),contextptr)/2/ab2);
gen D=4*ab2*rayon_a2-pow(delta,2);
if (is_strictly_greater(0,D,contextptr))
return vecteur(0);
gen d_perp(sqrt(D,contextptr)/2/ab2);
if (a2d){ // circle inter circle = 2 points (or 1)
gen ab_perp(im(ab,contextptr)-cst_i*re(ab,contextptr));
return makevecteur(symb_pnt(ratnormal(ab4+d_perp*ab_perp,contextptr),default_color(contextptr),contextptr),symb_pnt(ratnormal(ab4-d_perp*ab_perp,contextptr),default_color(contextptr),contextptr));
Expand Down

0 comments on commit dae6aff

Please sign in to comment.