skew-polygon

Edit and compile if you like:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0.125pt}
%
% File name: skew-polygon.tex
% Description: 
% A geometric representation of a skew polygon is shown.
% 
% Date of creation: October, 27th, 2021.
% Date of last modification: October, 9th, 2022.
% Author: Efraín Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% Source: page 352 of the 
% Glosario Ilustrado de Matem\'aticas Escolares.
% https://tinyurl.com/5udm2ufy
% English version: 
% https://tinyurl.com/yayyxrbz
% 
% Terms of use: According to TikZ.net
% https://creativecommons.org/licenses/by-nc-sa/4.0/
% Your commitment to the terms of use is greatly appreciated.
%
\begin{document}
%
\tdplotsetmaincoords{75}{110}
%
\begin{tikzpicture}[tdplot_main_coords,scale=1.75]
	\pgfmathsetmacro{\a}{3.0} % length
	\pgfmathsetmacro{\h}{1.0}	% height
	\pgfmathsetmacro{\n}{100}	% number of intervals
	% Vertices of the box
	\coordinate (O) at (0,0,0);
	\coordinate (A) at (\a,0,0);
	\coordinate (B) at (\a,\a,0);
	\coordinate (C) at (0,\a,0);
	\coordinate (D) at (0,0,\h);
	\coordinate (E) at (\a,0,\h);
	\coordinate (F) at (\a,\a,\h);
	\coordinate (G) at (0,\a,\h);
	% First I draw the box
	\draw[blue,thick,dashed] (O) -- (A) -- (B) -- (C) -- (O);	% plano z = 0
	\draw[blue,thick,dashed] (O) -- (D);	% Edge on the $z$ axis 
	\draw[blue,thick,dashed] (A) -- (E);	% vertical edge $(\a,0)$
	\draw[blue,thick,dashed] (C) -- (G);	% vertical edge $(0,\a)$
	% the surface (the skew polygon)
	\foreach \i in {1,2,...,\n}{
		\pgfmathsetmacro{\py}{((\i/\n)*\a}
		\pgfmathsetmacro{\pz}{(\h/\a)*\py}
		\draw[cyan,opacity=0.25] (\a,\py,\pz) -- (0.0,\py,\h-\pz);
		\draw[cyan,opacity=0.25] (\py,\a,\pz) -- (\py,0.0,\h-\pz);
	}
	% Edge of the skew polygon
	\draw[red,thick] (A) -- (F) -- (C) -- (D) -- (A);	
	% Edges of the external box
	\draw[blue,thick,dashed] (D) -- (E) -- (F) -- (G) -- (D);	% Plane $z = \h$
	\draw[blue,thick,dashed] (B) -- (F); % vertical edge $(\a,\a)$
%
\end{tikzpicture}
%	
\end{document}

Click to download: skew-polygon.tex • skew-polygon.pdf
Open in Overleaf:
skew-polygon.tex
See more on the author page of Efraín Soto Apolinar.

Leave a Reply

Your email address will not be published.