2

I just started to use latex. Anyone can help me how to draw a surface vector (outward normal vector) from the center on the face of Tetrahedron, especially using pst-solid3D?

I would like to draw something like the following scheme for Finite element method.

enter image description here

I know, the tetrahedron can be drawn using

\psSolid[object=tetrahedron,r=3,action=draw*,name=T, num=all, show=all, numfaces=all, RotX=120]

How can I put a normal vector on each face? Other another suggestion like using Tikz would be appreciated.

Stefan Pinnow
  • 29,535
k2park
  • 21

1 Answers1

1

Since you are saying you're also open to TikZ, here is a proposal based on an older answer.

\documentclass[tikz,border=3.14pt]{standalone}
\begin{document}
% starting point: https://tex.stackexchange.com/a/174424/121799
\begin{tikzpicture}[line join = round, line cap = round]
\pgfmathsetmacro{\factor}{1/sqrt(2)}; 
\coordinate [label=right:A] (A) at (2,0,-2*\factor);
\coordinate [label=left:B] (B) at (-2,0,-2*\factor);
\coordinate [label=above:C] (C) at (0,2,2*\factor);
\coordinate [label=below:D] (D) at (0,-2,2*\factor);

\coordinate (ABC) at (barycentric cs:A=1,B=1,C=1);
\coordinate (ABD) at (barycentric cs:A=1,B=1,D=1);
\coordinate (ACD) at (barycentric cs:A=1,C=1,D=1);
\coordinate (BCD) at (barycentric cs:B=1,C=1,D=1);

\draw[-latex] (ABC) -- ++(ABC);
\draw[-latex] (ABD) -- ++(ABD);

\draw[-latex] (0,0) -- (3,0,0) node[right] {$x$};
\draw[-latex] (0,0) -- (0,3,0) node[above] {$y$};
\draw[-latex] (0,0) -- (0,0,3) node[below left] {$z$};
\foreach \i in {A,B,C,D}
    \draw[dashed] (0,0)--(\i);
\draw[-, fill=red!30, opacity=.5] (A)--(D)--(B)--cycle;
\draw[-, fill=green!30, opacity=.5] (A) --(D)--(C)--cycle;
\draw[-, fill=purple!30, opacity=.5] (B)--(D)--(C)--cycle;

\draw[-latex] (ACD) -- ++(ACD);
\draw[-latex] (BCD) -- ++(BCD);

\end{tikzpicture}
\end{document}

enter image description here

The ugly point about this is that you need to draw things in the "correct" order. If you don't like to do this, you may use asymptote. If you want to change the viewing angle, you can do so by using the tikz-3dplot package.

  • Thank you @marmot. I'd like to keep your solution, just hoping to find any better, simple way, especially with pst-solid3d. – k2park Apr 08 '18 at 13:35
  • @k2park Sure. Even though I worked with pstricks for many many years and was very happy with it, I am ashamed to say that I forgot its syntax to the extent that I would have to spend a lot of time in order to do that in pstricks. –  Apr 08 '18 at 14:10