2

I am trying to put two figures side by side but the right one should be scaled by a certain factor to appear bigger than the one left figure. My progress so far is the following code. I tried looking at the manual but I cannot read French.

\documentclass[tikz]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}


\begin{document}
    \begin{tikzpicture}
        %Define Points
        \tkzDefPoint (0,0){A}
        \tkzDefPoint (4,0){B}
        \tkzDefPoint (5,1){C}
        \tkzDefPoint (3,2){D}
        \tkzDrawPolygon[fill=blue!40, very thick](A,B,C,D)

        %Label Points
        \tkzLabelPoint[left](A){A}
        \tkzLabelPoint(B){B}
        \tkzLabelPoint(C){C}
        \tkzLabelPoint[above](D){D}
        %Shift the Points
        \tkzDefShiftPoint[A](3 in, 0in){A'}
        \tkzDefShiftPoint[B](3 in, 0in){B'}
        \tkzDefShiftPoint[C](3 in, 0in){C'}
        \tkzDefShiftPoint[D](3 in, 0in){D'}
        \tkzDrawPolygon[fill=green!40, very thick,scale=3](A',B',C',D')
    \end{tikzpicture}
\end{document}
1

4 Answers 4

2

You could scale the points prior to translation:

\documentclass[tikz]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}


\begin{document}
    \begin{tikzpicture}
        %Define Points
        \tkzDefPoint (0,0){A}
        \tkzDefPoint (4,0){B}
        \tkzDefPoint (5,1){C}
        \tkzDefPoint (3,2){D}
        \tkzDrawPolygon[fill=blue!40, very thick](A,B,C,D)

        %Label Points
        \tkzLabelPoint[left](A){A}
        \tkzLabelPoint(B){B}
        \tkzLabelPoint(C){C}
        \tkzLabelPoint[above](D){D}

        %Scale the points about A with ratio 3
        \tkzDefPointBy[homothety=center A ratio 3](A)\tkzGetPoint{A};
        \tkzDefPointBy[homothety=center A ratio 3](B)\tkzGetPoint{B};
        \tkzDefPointBy[homothety=center A ratio 3](C)\tkzGetPoint{C};
        \tkzDefPointBy[homothety=center A ratio 3](D)\tkzGetPoint{D};

        %Shift the Points
        \tkzDefShiftPoint[A](3 in, 0in){A'}
        \tkzDefShiftPoint[B](3 in, 0in){B'}
        \tkzDefShiftPoint[C](3 in, 0in){C'}
        \tkzDefShiftPoint[D](3 in, 0in){D'}
        \tkzDrawPolygon[fill=green!40, very thick](A',B',C',D')
    \end{tikzpicture}
\end{document}

tkz-euclide scaled polygon

Disclaimer: I don't read French either and this is the first time I've looked at tkz-euclide. What I have seems to work, but I find the argument structure for \tkzDefPointBy very odd. I'd recommend using straight tikz (see cfr's answer) for something like this.

2

The answer of Guho is fine but there are other methods :

 \documentclass[tikz]{article}
 \usepackage{tkz-euclide}
 \usetkzobj{all}


 \begin{document}
 \begin{tikzpicture}
    %Define Points
    \tkzDefPoint (0,0){A}
    \tkzDefPoint (4,0){B}
    \tkzDefPoint (5,1){C}
    \tkzDefPoint (3,2){D}
    \tkzDrawPolygon[fill=blue!40, very thick](A,B,C,D)
 \end{tikzpicture}
 \begin{tikzpicture}[scale=2]
    %Define Points
    \tkzDefPoint (0,0){A}
    \tkzDefPoint (4,0){B}
    \tkzDefPoint (5,1){C}
    \tkzDefPoint (3,2){D}
    \tkzDrawPolygon[fill=green!40, very thick](A,B,C,D)
\end{tikzpicture}

\begin{tikzpicture}
    %Define Points
    \tkzDefPoint (0,0){A}
    \tkzDefPoint (4,0){B}
    \tkzDefPoint (5,1){C}
    \tkzDefPoint (3,2){D}
    \tkzDrawPolygon[fill=blue!40, very thick](A,B,C,D)

\begin{scope}[xshift=5cm,x=2cm,y=2cm]
    %Define Points
    \tkzDefPoint (0,0){A}
    \tkzDefPoint (4,0){B}
    \tkzDefPoint (5,1){C}
    \tkzDefPoint (3,2){D}
    \tkzDrawPolygon[fill=red!40, very thick](A,B,C,D)
\end{scope}
    \end{tikzpicture}
\end{document}

enter image description here

1

I don't read French either. People who can say the examples make it all clear. But not to me, apparently.

\documentclass[border=5pt, multi, tikz, italian]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
  \path [draw, very thick, fill=blue!40] (0,0) \foreach \i/\j/\k in {(0,0)/A/left,(4,0)/B/right,(5,1)/C/right,(3,2)/D/above}
  {
    -- \i coordinate (\j) node [\k] {\j}
  } -- cycle;
  \path [draw, very thick, fill=green!40] (3in,0) -- +($3*(B)$) -- +($3*(C)$) -- +($3*(D)$) -- cycle;
\end{tikzpicture}
\end{document}

scaled polygon

2
  • The examples section of the manual is in English. Scroll along to the end.
    – Thruston
    Jan 20, 2016 at 9:46
  • I'll look for that next time. For this, TikZ seems easier and less verbose.
    – cfr
    Jan 20, 2016 at 18:06
0

This is much simpler in Metapost because you can apply a transformation to a whole path instead of having to do it one point at a time.

enter image description here

prologues:=3;outputtemplate:="%j%c.eps";
beginfig(1);

path poly, small_poly, big_poly;

poly = origin -- (4,0) -- (5,1) -- (3,2) -- cycle;
small_poly = poly scaled 30;
big_poly   = poly scaled 50 shifted 200 right;

fill small_poly withcolor .6[blue,white]; 
draw small_poly;

fill big_poly withcolor .6[green,white]; 
draw big_poly;

label.lft("A", point 0 of small_poly); 
label.lrt("B", point 1 of small_poly); 
label.rt ("C", point 2 of small_poly); 
label.top("D", point 3 of small_poly); 

endfig;
end
1
  • It's possible to use a method similar with tikz Feb 28, 2016 at 20:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .