SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

Points
Even a stopped clock is right once a day.
English proverb

Linear Combinations

Midpoints

TiKZ Listing: Fig.tikz.tex. PDF   PNG   SVG   ZIP*  
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
   \begin{tikzpicture}
       \tikzstyle{P}=[right]
       \tikzstyle{M}=[left]
       
       %Define coordinates
       \coordinate (P1) at (1,2);
       \coordinate (P2) at (-3,1);
       \coordinate (P3) at (2,-3);
       
       %%draw the triangle
       \draw (P1) -- (P2) -- (P3) -- cycle;
       
       %Draw nodes with titles
       \filldraw (P1) circle(1pt) node[P] {$P_1$};
       \filldraw (P2) circle(1pt) node[P] {$P_2$};
       \filldraw (P3) circle(1pt) node[P] {$P_3$};
        
       %Drawing - cyclic
       \coordinate (M1) at ($0.5*(P2)+0.5*(P3)$);
       \coordinate (M2) at ($0.5*(P3)+0.5*(P1)$);
       \coordinate (M3) at ($0.5*(P1)+0.5*(P2)$);
       
       %Draw in loop
       %2-level \foreach
       \foreach \M/\title in { (M1)/$M_1$,(M2)/$M_2$,(M3)/$M_3$}
       {
          \filldraw \M circle(1pt) node[M] {\title};
       }
       
       %Draw Medians
       \foreach \P/\Q in { (P1)/(M1),(P2)/(M2),(P3)/(M3)}
       {
          \draw[dotted] \P -- \Q;
       }
       
       %Geometrical center of triangle
       \coordinate (M) at ($(P1)+(P2)+(P3)$);
       \coordinate (M) at ($1/3*(M)$);
       
       %Draw
       \filldraw (M) circle(1pt) node[M] {$M$};
   \end{tikzpicture}
\end{document}
Messages:
0 secs.