4

I have the following picture:

trapezium

I tried to draw it with tikz:

\documentclass[tikz,border=1mm,usenames,dvipsnames]{standalone}
\usepackage{tikz, pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{patterns}
\usetikzlibrary{calc,matrix}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes}

\definecolor{amber}{rgb}{1.0, 0.49, 0.0}
\definecolor{antique}{rgb}{0.8, 0.58, 0.46}
\definecolor{pastelorange}{rgb}{1.0, 0.7, 0.28}

\begin{document}

\begin{tikzpicture}
\node[trapezium, draw, very thin, trapezium left angle=120, trapezium right angle=60] at (0,0) {};
\end{tikzpicture}
\end{document}

which results in:

mywork

What I am not able to do:

  • mirror the object
  • fill it (hatch it) with colored stripes
  • make the arrows (vectors)

Is it possible to do the same with 3D object (parallelepiped)?

Thanks all !

2
  • 1
    Please: one question per question! You have 4 here. 3 are arguably closely related enough to count as 1, but the 3D case should definitely be a different question. If you ask that one separately, please don't assume people know what a parallelepiped looks like. I have zero idea.
    – cfr
    Commented Nov 10, 2023 at 17:35
  • Note that hatching is different. TikZ calls it cross-hatching when two sets of lines are used, which cross each other e.g. northeast to southwest and southeast to northwest. I'm assuming you want just one set of lines since you specify 'stripes' and show that in your picture.
    – cfr
    Commented Nov 10, 2023 at 17:40

2 Answers 2

6
\documentclass[tikz,border=1mm,usenames,dvipsnames]{standalone}
% ateb https://tex.stackexchange.com/a/700945/: addaswyd o gwestiwn JoudaBouda: https://tex.stackexchange.com/q/700934/
\usepackage{tikz}
\usetikzlibrary{patterns,patterns.meta}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.geometric}

\begin{document}

\begin{tikzpicture}
  \node (p)[pattern={Lines[angle=120,line width=.1pt,distance=.5pt]}, pattern color=gray, trapezium, draw, very thin, trapezium right angle=120] at (0,0) {};
  \draw [-{Stealth[length=1pt]},ultra thin] (p.bottom left corner) ++(45:.5\pgflinewidth) coordinate (a) -- ([xshift=-.5\pgflinewidth,yshift=.5\pgflinewidth]p.bottom right corner);
  \draw [-{Stealth[length=1pt]},ultra thin] (a) -- ([xshift=.5\pgflinewidth,yshift=-.5\pgflinewidth]p.top left corner);
\end{tikzpicture}
\end{document}

parallelogram with hatching and vectors

2
  • 2
    The result makes my eyes go funny.
    – cfr
    Commented Nov 10, 2023 at 17:36
  • 1
    If you use outer sep=0pt for the node, you can just do \path[very thin, every edge/.style=tips, -Stealth] (p.bottom left corner) edge (p.bottom right corner) edge (p.top left corner);. (very thin is the same line width as for the node to scale the arrow tip appropriately w/o hard-coded numbers, tips only draws the tips but not the path unless draw is used. Of course, this is a very tiny trapezium (no text, no minimum sizes) so things might need adjustments.) Commented Nov 16, 2023 at 15:58
5
% !TEX TS-program = lualatex
\documentclass{standalone} 
\usepackage{tkz-euclide}
\usepackage{tkz-elements}

\usetikzlibrary{patterns,patterns.meta}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shapes.geometric}

\begin{document}
   
\begin{tkzelements}
   z.A         = point: new(0,0)
   z.B         = point: new(5,0)
   z.C         = point: new(1,4)
   T.ABC       = triangle: new (z.A,z.B,z.C)
   z.D = T.ABC : parallelogram ()
\end{tkzelements}

\begin{tikzpicture}
   \tkzGetNodes
   \tkzDrawPolygon(A,...,D)
   \tkzFillPolygon[pattern={Lines[angle=60,distance=8pt]},
       pattern   color=black](A,...,D)
   \tkzDrawSegments[-stealth,line width=1pt](A,B A,D)
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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