# Problem with the scale option. What is the PGF method for scaling?

I discover a problem with my example of reference for the new version of tkz-euclide v2.56c

Before seeing the details, I draw several pictures with different scale values. I don't have any problem with scale=1, scale=0.5 scale=2 and scale=4 but I get a wtrong result with other scales like scale=0.75 or scale=1.5. It is difficult to know where the error comes from : TikZ or tkz-euclide.

My trials and research and thoughs

1. 0.5 1 2 4 It's strange that only powers of 2 give a good result
2. I used two method to get the expected result, one is long the other short. The first method is fine (no problem), the second uses new tools of the package to prevent the user from making unnecessary calculations. This last method is problematic
3. The expected result ? : A triangle ABC is given.We trace the exinscribed circles and we search THE Apollonius Circle it's the circle tangent It is the circle tangent to the three circles inscribed around them
4. I change the coordinates by hand the result is correct :0.75 of 6,0.8 and 4 with scale = 1

I give two pictures with scale =0.5 and scale=.75 The second method is in red

% !TEX TS-program = lualatex-dev
\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide} % v2.56c
\usetikzlibrary{spy}
\begin{document}

\begin{tikzpicture}[spy using outlines={circle,
magnification=10, size=3cm, connect spies},scale=0.75]

\tkzDefPoints{0/0/A,6/0/B,0.8/4/C}% A triangle

\tkzEulerCenter(A,B,C)     \tkzGetPoint{N} % N  Nine-point center (euler)
\tkzCircumCenter(A,B,C)    \tkzGetPoint{O} % O  Circumcenter
\tkzLemoinePoint(A,B,C)    \tkzGetPoint{K} % K  Symmedian  or Lemoine center
\tkzDefTriangleCenter[spieker](A,B,C) \tkzGetPoint{Sp}  % Sp Spieker center
%<-------------------------------------------------------->
% First Method I define the excircles
%<-------------------------------------------------------->
\tkzDefExCircle(A,B,C)     \tkzGetPoint{Jb} \tkzGetLength{rb}
\tkzDefExCircle(C,A,B)     \tkzGetPoint{Ja} \tkzGetLength{ra}
\tkzDefExCircle(B,C,A)     \tkzGetPoint{Jc} \tkzGetLength{rc}
% try to get thre points on the Apollonius Circle
\tkzDefPointBy[projection=onto B--C ](Jc)   \tkzGetPoint{Xc}
\tkzDefPointBy[projection=onto B--C ](Jb)   \tkzGetPoint{Xb}
\tkzDefPointBy[projection=onto A--B ](Ja)   \tkzGetPoint{Za}
\tkzDefPointBy[projection=onto A--B ](Jb)   \tkzGetPoint{Zb}
\tkzDefLine[parallel=through Xc](A,C)       \tkzGetPoint{X'c}
\tkzDefLine[parallel=through Xb](A,B)       \tkzGetPoint{X'b}
\tkzDefLine[parallel=through Za](C,A)       \tkzGetPoint{Z'a}
\tkzDefLine[parallel=through Zb](C,B)       \tkzGetPoint{Z'b}
\tkzInterLL(Xc,X'c)(A,B)                    \tkzGetPoint{B'}
\tkzInterLL(Xb,X'b)(A,C)                    \tkzGetPoint{C'}
\tkzInterLL(Za,Z'a)(C,B)                    \tkzGetPoint{A''}
\tkzInterLL(Zb,Z'b)(C,A)                    \tkzGetPoint{B''}
\tkzDefPointBy[reflection= over Jc--Jb](B') \tkzGetPoint{Ca}
\tkzDefPointBy[reflection= over Jc--Jb](C') \tkzGetPoint{Ba}
\tkzDefPointBy[reflection= over Ja--Jb](A'')\tkzGetPoint{Bc}
\tkzDefPointBy[reflection= over Ja--Jb](B'')\tkzGetPoint{Ac}
% I have three points Ac,Ca,Ba
% Now I search the center of the circle (circumcenter)
\tkzDefCircle[circum](Ac,Ca,Ba)             \tkzGetPoint{Q}
\tkzDrawCircle[circum](Ac,Ca,Ba)
%<-------------------------------------------------------->
% END METHOD 1
%<-------------------------------------------------------->
%<-------------------------------------------------------->
%  METHOD 2
% Q in the intersection of K,O and N,Sp
%<-------------------------------------------------------->
\tkzInterLL(O,K)(N,Sp)                      \tkzGetPoint{Q'}
\tkzDrawPoint[red](Q')
\tkzDefMidPoint(A,B)                        \tkzGetPoint{M}
\tkzDefLine[parallel=through Q'](N,M)       \tkzGetPoint{q}
\tkzInterLL(Q',q)(M,Sp)                     \tkzGetPoint{z}
\tkzDrawLines[add=10 and 2,red](M,Sp Q',q N,M)
\tkzDrawCircle[red,line width=4pt,opacity=.2](Q,z)
\tkzLabelPoints[above](z)
\tkzLabelPoints[below](M)
%<-------------------------------------------------------->
% END METHOD 2
%<-------------------------------------------------------->
% Now it's only the drawing
\tkzDrawPolygon[color=blue](A,B,C)
\tkzDrawPolygon[dashed,color=blue](Ja,Jb,Jc) %
\tkzDrawCircles[ex](A,B,C B,C,A C,A,B) % circles exinscrits
\tkzDrawLines[add=0 and 0,dashed](Ca,Bc B,Za A,Ba B',C')
\tkzDrawLine[add=1 and 1,dashed](Xb,Xc)
\tkzDrawLine[add=7 and 3,blue](O,K)
\tkzDrawLine[add=8 and 15,red](N,Sp)
\tkzDrawLines[add=10 and 10](K,O N,Sp Q,q M,Sp)
\tkzDrawSegments(Ba,Ca Bc,Ac)
\tkzDrawPoints(A,B,C,N,Ja,Jb,Jc,Xb,Xc,B',C',Za,Zb,Ba,Ca,Bc,Ac,Q,Sp,K,O,z)
\tkzLabelPoints(A,B,C,N,Ja,Jb,Jc,Xb,Xc,B',C',Za,Zb,Ba,Ca,Bc,Ac,Q,Sp)
\tkzLabelPoints[above](K,O)
% spy
\spy [green] on (Q) in node [left] at ([xshift=4cm,yshift=2cm]Q);
\spy [green] on (z) in node [left] at ([xshift=-4cm,yshift=-2cm]z);
\end{tikzpicture}
\end{document}


With scale=0.75

With scale=0.5 the result is perfect

• +1 but it is very hard to debug this for beings who do not happen to be authors of the package. ;-)
– user194703
Commented Jan 9, 2020 at 15:26
• @Schrödinger'scat Maybe you have an idea where to look? I'm not sure that the problem comes from my package because the result is correct for some values ... That's why I asked if anyone knew what pgf was doing during a scale. I am trying to isolate the problem but it is hard. I'm also trying to find out if other TikZ users have had a problem with the scale option Commented Jan 9, 2020 at 16:03

## 1 Answer

The problem is not entirely resolved, but I am on the right track. I had to redefine mathematically correct construction methods. I avoided using trigonometry and if possible I used xfp. Tarass put me on the way of a method using lua and L3 with excellent results, it will be the next step. The problem is that of the precision of the different tools. I had used two 60 degree rotations to determine a mediator it was ok but ultimately that was a problem. The problem is between some calculations and the option scale`.

With scale=0.75