polygon-is-point-inside.tex 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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]
  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]270:$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, fill=orange!25] (A) -- (B) -- (C) -- (D) -- (E) -- (F) -- (G) -- cycle;
  17. \coordinate[label={[label distance=0.05cm]270:$E$}] (E) at (2,2);
  18. \node (P) [point] at (2,3.5) {};
  19. \draw[line] (P.center) -- (A);
  20. \draw[line] (P.center) -- (B);
  21. \draw[line] (P.center) -- (C);
  22. \draw[line] (P.center) -- (D);
  23. \draw[line] (P.center) -- (E);
  24. \draw[line] (P.center) -- (F);
  25. \draw[line] (P.center) -- (G);
  26. \node (P) [point, label={[above]{$P$}}] at (2,3.5) {};
  27. \draw[polygon] (A) -- (B) -- (C) -- (D) -- (E) -- (F) -- (G) -- cycle;
  28. \end{tikzpicture}
  29. \end{document}