3

I am trying to create a tikz image based on the following screenshot:

enter image description here

I can figure out how to draw a pyramid, but I have so far been hopeless at drawing the red shaded regions. Here is the minimal progress I have made:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    [x={(0.648577cm, -0.290453cm)},
    y={(0.759883cm, 0.300370cm)},
    z={(-0.043879cm, 0.908523cm)},
    scale=2.000000,
    back/.style={densely dotted, thin},
    edge/.style={densely dotted, thin},
    facet/.style={fill=blue!95!black,fill opacity=0.000000},
    vertex/.style={inner sep=1pt,circle,draw=green!25!black,fill=green!75!black,thick,anchor=base}]

\coordinate (-0.75000, -0.75000, -0.75000) at (-0.75000, -0.75000, -0.75000);
\coordinate (0.75000, -0.75000, -0.75000) at (0.75000, -0.75000, -0.75000);
\coordinate (-0.75000, 0.75000, -0.75000) at (-0.75000, 0.75000, -0.75000);
\coordinate (0.75000, 0.75000, -0.75000) at (0.75000, 0.75000, -0.75000);
\coordinate (0.00000, 0.00000, 1.00000) at (0.00000, 0.00000, 1.00000);

\fill[facet] (0.00000, 0.00000, 1.00000) -- (-0.75000, -0.75000, -0.75000) -- (-0.75000, 0.75000, -0.75000) -- cycle {};
\fill[facet] (0.00000, 0.00000, 1.00000) -- (-0.75000, -0.75000, -0.75000) -- (0.75000, -0.75000, -0.75000) -- cycle {};
\fill[facet] (0.00000, 0.00000, 1.00000) -- (0.75000, -0.75000, -0.75000) -- (0.75000, 0.75000, -0.75000) -- cycle {};
\fill[facet] (0.00000, 0.00000, 1.00000) -- (-0.75000, 0.75000, -0.75000) -- (0.75000, 0.75000, -0.75000) -- cycle {};

\draw[edge] (-0.75000, -0.75000, -0.75000) -- (0.75000, -0.75000, -0.75000);
\draw[edge] (-0.75000, -0.75000, -0.75000) -- (-0.75000, 0.75000, -0.75000);
\draw[edge] (-0.75000, -0.75000, -0.75000) -- (0.00000, 0.00000, 1.00000);
\draw[edge] (0.75000, -0.75000, -0.75000) -- (0.75000, 0.75000, -0.75000);
\draw[edge] (0.75000, -0.75000, -0.75000) -- (0.00000, 0.00000, 1.00000);
\draw[edge] (-0.75000, 0.75000, -0.75000) -- (0.75000, 0.75000, -0.75000);
\draw[edge] (-0.75000, 0.75000, -0.75000) -- (0.00000, 0.00000, 1.00000);
\draw[edge] (0.75000, 0.75000, -0.75000) -- (0.00000, 0.00000, 1.00000);

\node[vertex] at (-0.75000, -0.75000, -0.75000)     {};
\node[vertex] at (0.75000, -0.75000, -0.75000)     {};
\node[vertex] at (-0.75000, 0.75000, -0.75000)     {};
\node[vertex] at (0.75000, 0.75000, -0.75000)     {};
\node[vertex] at (0.00000, 0.00000, 1.00000)     {};

\end{tikzpicture}

\end{document}
  • Even showing how to draw one of the red shaded regions in tikz would enable me to figure out how to draw the whole diagram. – Student Dec 10 '17 at 12:24
2

It is rather easy to create something similar with asymptote.

 \documentclass{article}
 \usepackage[inline]{asymptote}
 \begin{document}
 \thispagestyle{empty}
 % from http://www.piprime.fr/files/asymptote/modules/polyhedron_js/index.html
 \begin{asy}
import polyhedron_js;
import three;

currentprojection=perspective(6,6,-1);

// comment the following line for OpenGl
// settings.render=0;

settings.tex="pdflatex";
settings.outformat="pdf"; // for opacity

// uncomment these lines for the coordinate axes
//   real r=1.5;
//   draw(Label("$x$",1), O--r*X, Arrow3(HookHead3));
//   draw(Label("$y$",1), O--r*Y, Arrow3(HookHead3));
//   draw(Label("$z$",1), O--r*Z, Arrow3(HookHead3));

polyhedron pyramid;
real sq2=sqrt(2)/2; real sq4=sqrt(2)/4;
pyramid[0]=(-sq2,-sq2,0)--(-sq2,sq2,0)--(sq2,sq2,0)--(sq2,-sq2,0)--cycle;
pyramid[1]=(sq2,-sq2,0)--(sq2,sq2,0)--(0,0,1)--cycle;
pyramid[2]=(sq2,sq2,0)--(-sq2,sq2,0)--(0,0,1)--cycle;
pyramid[3]=(-sq2,sq2,0)--(-sq2,-sq2,0)--(0,0,1)--cycle;
pyramid[4]=(-sq2,-sq2,0)--(sq2,-sq2,0)--(0,0,1)--cycle;
size(10cm);
polyhedron[] parr={shift(0,0,-sq2/2)*rotate(0,Z)*pyramid};
filldraw(parr,new pen[]{0.9blue},op=1); //

//  if(!is3D())
//    shipout(bbox(3mm,darkblue+3bp+miterjoin,FillDraw(paleblue))); 

//    draw(shift(0,0,0.5)*scale3(1)*surface(unitcircle3),opacity(0.2));

real radius=1.8;
path3 p3=O--arc(O,radius,0,0,180,0)--cycle; // define a wedge
draw(shift(0sq2/2,0sq2/2,0)*rotate(45,X)*surface(p3), blue+opacity(0.2));   
draw(shift(0sq2/2,0sq2/2,0)*rotate(-45,Y)*rotate(90,Z)*surface(p3), blue+opacity(0.2)); 
path3 p4=O--arc(O,radius,0,0,90,0)--cycle; // define a wedge
draw(shift(0sq2/2,0sq2/2,0)*rotate(90,Z)*rotate(90,X)*surface(p4), blue+opacity(0.2));  
// draw(shift(0sq2/2,0sq2/2,0)*rotate(45,Z)*rotate(45,X+Y)*rotate(45,Z)*surface(p4), blue+opacity(0.2));    
\end{asy}
\end{document}

enter image description here

You need to run xelatex, then there will be an .asy file, which you need to process with asy, and then you need to run xelatex twice. This is just a starting point, I did not make too much of an effort because I did not know whether you consider asymptote based solutions at all.

  • This looks great, but for a variety of reasons, I would prefer a tikz implementation. – Student Dec 10 '17 at 8:17

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.