6

How can I fill this pyramid like this picture? (with GeoSpacW) enter image description here

I tried (with GeoGebra)

\documentclass[12pt]{standalone}
\usepackage{fouriernc}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-0.5165217391304349,-3.515177065767286) rectangle (8.983478260869564,5.484822934232715);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (0.,0.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (2.,-3.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (6.,-3.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (8.,0.);
\draw [line width=1.2pt] (8.,0.)-- (6.,-3.);
\draw [line width=1.2pt] (6.,-3.)-- (2.,-3.);
\draw [line width=1.2pt] (2.,-3.)-- (0.,0.);
\draw [dash pattern=on 2pt off 2pt] (0.,0.)-- (8.,0.);
\draw [dash pattern=on 2pt off 2pt] (0.,0.)-- (6.,-3.);
\draw [dash pattern=on 2pt off 2pt] (4.960217391304347,2.332630691399663)-- (1.,-1.5);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (1.,-1.5);
\draw [dash pattern=on 2pt off 2pt] (1.,-1.5)-- (8.,0.);
\draw [dash pattern=on 2pt off 2pt] (1.,-1.5)-- (4.,-3.);
\draw [dash pattern=on 2pt off 2pt] (1.9204347826086954,4.665261382799326)-- (2.4,-1.2);
\draw [dash pattern=on 2pt off 2pt] (0.3200724637681158,0.7775435637998873)-- (4.960217391304347,2.332630691399663);
\draw [line width=1.2pt] (4.960217391304347,2.332630691399663)-- (5.320072463768115,-1.7224564362001122);
\draw [line width=1.2pt] (5.320072463768115,-1.7224564362001122)-- (4.,-3.);
\draw [line width=1.2pt] (1.,-1.5)-- (0.3200724637681158,0.7775435637998873);
\draw [dash pattern=on 2pt off 2pt] (0.3200724637681158,0.7775435637998873)-- (5.320072463768115,-1.7224564362001122);
\draw [fill=black] (0.,0.) circle (1.5pt);
\draw[color=black] (-0.12826086956521748,-0.25210792580101227) node {$A$};
\draw [fill=black] (8.,0.) circle (1.5pt);
\draw[color=black] (8.25,0.15) node {$B$};
\draw [fill=black] (6.,-3.) circle (1.5pt);
\draw[color=black] (6.0260869565217385,-3.2116357504215856) node {$C$};
\draw [fill=black] (2.,-3.) circle (1.5pt);
\draw[color=black] (1.928695652173913,-3.2116357504215856) node {$D$};
\draw [fill=black] (1.9204347826086954,4.665261382799326) circle (1.5pt);
\draw[color=black] (1.978260869565217,4.877740303541315) node {$S$};
\draw [fill=black] (1.,-1.5) circle (1.5pt);
\draw[color=black] (0.8,-1.7242833052276565) node {$M$};
\draw [fill=black] (4.960217391304347,2.332630691399663) circle (1.5pt);
\draw[color=black] (5.018260869565217,2.6) node {$N$};
\draw [fill=black] (4.,-3.) circle (1.5pt);
\draw[color=black] (3.944347826086956,-3.226812816188871) node {$E$};
\draw [fill=black] (2.4,-1.2) circle (1.5pt);
\draw[color=black] (2.399565217391304,-1.45) node {$O$};
\draw [fill=black] (2.320072463768116,-0.2224564362001124) circle (1.5pt);
\draw[color=black] (2.250869565217391,-0.5101180438448571) node {$I$};
\draw [fill=black] (0.3200724637681158,0.7775435637998873) circle (1.5pt);
\draw[color=black] (0.2186956521739129,1.0379426644182121) node {$G$};
\draw [fill=black] (5.320072463768115,-1.7224564362001122) circle (1.5pt);
\draw[color=black] (5.5,-1.5118043844856666) node {$F$};
\end{tikzpicture}
\end{document}

and got enter image description here

  • I assume the picture represents a pyramid that has been cut by a plane going through the points EFNGM, correct? – Werner Dec 10 '15 at 4:31
  • @Werner Yes. Correct. – minthao_2011 Dec 10 '15 at 4:44
  • Would it be ok to use a transparent color (fill) instead of a pattern? It would sure be easier. – John Kormylo Dec 10 '15 at 5:53
9

Add coordinates where geogebra define vertices (circle (1.5pt)), like

\draw [fill=black] (0.,0.) circle (1.5pt) coordinate (A);

and fill the desired closed area with your preferred pattern

\path[pattern=vertical lines, pattern color=red] (G)--(M)--(E)--(F)--(N)--cycle;

The complete code:

\documentclass[12pt]{standalone}
\usepackage{fouriernc}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows,patterns}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(-0.5165217391304349,-3.515177065767286) rectangle (8.983478260869564,5.484822934232715);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (0.,0.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (2.,-3.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (6.,-3.);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (8.,0.);
\draw [line width=1.2pt] (8.,0.)-- (6.,-3.);
\draw [line width=1.2pt] (6.,-3.)-- (2.,-3.);
\draw [line width=1.2pt] (2.,-3.)-- (0.,0.);
\draw [dash pattern=on 2pt off 2pt] (0.,0.)-- (8.,0.);
\draw [dash pattern=on 2pt off 2pt] (0.,0.)-- (6.,-3.);
\draw [dash pattern=on 2pt off 2pt] (4.960217391304347,2.332630691399663)-- (1.,-1.5);
\draw [line width=1.2pt] (1.9204347826086954,4.665261382799326)-- (1.,-1.5);
\draw [dash pattern=on 2pt off 2pt] (1.,-1.5)-- (8.,0.);
\draw [dash pattern=on 2pt off 2pt] (1.,-1.5)-- (4.,-3.);
\draw [dash pattern=on 2pt off 2pt] (1.9204347826086954,4.665261382799326)-- (2.4,-1.2);
\draw [dash pattern=on 2pt off 2pt] (0.3200724637681158,0.7775435637998873)-- (4.960217391304347,2.332630691399663);
\draw [line width=1.2pt] (4.960217391304347,2.332630691399663)-- (5.320072463768115,-1.7224564362001122);
\draw [line width=1.2pt] (5.320072463768115,-1.7224564362001122)-- (4.,-3.);
\draw [line width=1.2pt] (1.,-1.5)-- (0.3200724637681158,0.7775435637998873);
\draw [dash pattern=on 2pt off 2pt] (0.3200724637681158,0.7775435637998873)-- (5.320072463768115,-1.7224564362001122);
\draw [fill=black] (0.,0.) circle (1.5pt) coordinate (A);
\draw[color=black] (-0.12826086956521748,-0.25210792580101227) node {$A$};
\draw [fill=black] (8.,0.) circle (1.5pt) coordinate (B);
\draw[color=black] (8.25,0.15) node {$B$};
\draw [fill=black] (6.,-3.) circle (1.5pt) coordinate (C);
\draw[color=black] (6.0260869565217385,-3.2116357504215856) node {$C$};
\draw [fill=black] (2.,-3.) circle (1.5pt) coordinate (D);
\draw[color=black] (1.928695652173913,-3.2116357504215856) node {$D$};
\draw [fill=black] (1.9204347826086954,4.665261382799326) circle (1.5pt) coordinate (S);
\draw[color=black] (1.978260869565217,4.877740303541315) node {$S$};
\draw [fill=black] (1.,-1.5) circle (1.5pt) coordinate (M);
\draw[color=black] (0.8,-1.7242833052276565) node {$M$};
\draw [fill=black] (4.960217391304347,2.332630691399663) circle (1.5pt) coordinate (N);
\draw[color=black] (5.018260869565217,2.6) node {$N$};
\draw [fill=black] (4.,-3.) circle (1.5pt) coordinate (E);
\draw[color=black] (3.944347826086956,-3.226812816188871) node {$E$};
\draw [fill=black] (2.4,-1.2) circle (1.5pt) coordinate (O);
\draw[color=black] (2.399565217391304,-1.45) node {$O$};
\draw [fill=black] (2.320072463768116,-0.2224564362001124) circle (1.5pt) coordinate (I);
\draw[color=black] (2.250869565217391,-0.5101180438448571) node {$I$};
\draw [fill=black] (0.3200724637681158,0.7775435637998873) circle (1.5pt) coordinate (G);
\draw[color=black] (0.2186956521739129,1.0379426644182121) node {$G$};
\draw [fill=black] (5.320072463768115,-1.7224564362001122) circle (1.5pt) coordinate (F);
\draw[color=black] (5.5,-1.5118043844856666) node {$F$};
\path[pattern=vertical lines, pattern color=red] (G)--(M)--(E)--(F)--(N)--cycle;
\end{tikzpicture}
\end{document}

and the result:

enter image description here

  • How can I chose style of segments MN and GN are dash? – minthao_2011 Dec 10 '15 at 8:26
  • How can I chose style of segments ME and GN are dash? – minthao_2011 Dec 10 '15 at 8:37
  • @minthao_2011 If you use \path[pattern=... instead of \draw[red, pattern ... the area border is not drawn and original black dashed or solid lines are not covered. – Ignasi Dec 10 '15 at 8:37
  • I did. But I could not get style of segments ME and GN are dash. – minthao_2011 Dec 10 '15 at 9:09
  • @minthao_2011 I've updated the code ans resulting figure. In code I've only changed third last line as in my previous comment. As you can see ME and GN are dashed lines. – Ignasi Dec 10 '15 at 10:42
1

I tried with tkz-euclide My code

\documentclass[border=2mm,12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tkz-euclide,amsmath} 
\usetkzobj{all} 
\tikzset{hidden/.style = {thick, dotted}}
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoints{0/0/A,
8/0/B,
6/-3/C,
2/-3/D,
1/5/S}
\tkzDefMidPoint(A,D)                      \tkzGetPoint{M}
\tkzDefMidPoint(S,B)                      \tkzGetPoint{N}
\tkzDefMidPoint(D,C)                      \tkzGetPoint{E}
\tkzInterLL(A,C)(M,B) \tkzGetPoint{O}
\tkzInterLL(M,N)(S,O) \tkzGetPoint{I}
\tkzDefLine[parallel=through I](A,C)
 \tkzGetPoint{d}
\tkzInterLL(d,I)(S,C) \tkzGetPoint{F}
\tkzInterLL(d,I)(S,A) \tkzGetPoint{G}
\tkzLabelPoints[right](B,C,I,F)
\tkzLabelPoints[left](A,D,M,G)
\tkzLabelPoints[above](S)
\tkzLabelPoints[below](O,E)
\tkzLabelPoints[above,right](N)
\tkzDrawPoints[color=black](A,B,C,D,S,M,N,O,I,F,G,E)
\tkzDrawSegments[hidden](A,B A,C M,N M,B S,O G,F M,E G,N)
\tkzDrawSegments(B,C C,D D,A S,A S,B S,C S,D S,M G,M E,F F,N)
\tkzFillPolygon[pattern color=red, pattern=vertical lines](G,M,E,F,N)
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.