polygon-is-point-inside.tex 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{tikz}
  3. \usetikzlibrary{shapes.geometric,positioning,calc,shapes.misc}
  4. \begin{document}
  5. \tikzstyle{polygon}=[very thick, fill=orange!25]
  6. \tikzstyle{point}=[ultra thick,draw=gray,cross out,inner sep=0pt,minimum width=4pt,minimum height=4pt,]
  7. \tikzstyle{line}=[red]
  8. \begin{tikzpicture}
  9. \coordinate[label=left:$A$] (A) at (1,0);
  10. \coordinate[label=right:$B$] (B) at (3,0);
  11. \coordinate[label=right:$C$] (C) at (4,2);
  12. \coordinate[label=above:$D$] (D) at (3,4);
  13. \coordinate[label={[label distance=0.5cm]90:$E$}] (E) at (2,2);
  14. \coordinate[label=above:$F$] (F) at (1,4);
  15. \coordinate[label=left:$G$] (G) at (0,2);
  16. \draw[polygon] (A) -- (B) -- (C) -- (D) -- (E) -- (F) -- (G) -- cycle;
  17. \node (P) [point, label={[right]{$P$}}] at (2,3.5) {};
  18. \draw[line] (P) -- (A);
  19. \draw[line] (P) -- (B);
  20. \draw[line] (P) -- (C);
  21. \draw[line] (P) -- (D);
  22. \draw[line] (P) -- (E);
  23. \draw[line] (P) -- (F);
  24. \draw[line] (P) -- (G);
  25. \end{tikzpicture}
  26. \end{document}