我该如何放置这个金字塔的标签位置?

我该如何放置这个金字塔的标签位置?

M, N, P, O我该如何放置这个金字塔的标签位置?我试过了

\documentclass[12pt,border=3]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{fouriernc}
\begin{document}

\newcommand\pgfmathsinandcos[3]{%
  \pgfmathsetmacro#1{sin(#3)}%
  \pgfmathsetmacro#2{cos(#3)}%
}

\begin{tikzpicture}[scale=1.5]

\pgfmathsetmacro\AngleFuite{135}
\pgfmathsetmacro\coeffReduc{.8}
\pgfmathsetmacro\clen{2}
\pgfmathsinandcos\sint\cost{\AngleFuite}

\begin{scope} [x     = {(\coeffReduc*\cost,-\coeffReduc*\sint)},
               y     = {(1cm,0cm)},
               z     = {(0cm,1cm)}]

\path coordinate (O) at (0,0,0)
      coordinate[label=$M$]  (B) at (0,5,0)
      coordinate[label=$N$] (A) at (5,0,0)
      coordinate[label=$P$] (C) at (0,0,5)
      coordinate[label=$O$] (O) at (0,0,0)
      ;
\draw[thick,-stealth,blue]  (0,0,5)  -- (0,0,6);
\draw[thick,-stealth,red]   (5,0,0)  -- (6,0,0);
\draw[thick,-stealth,green] (0,5,0)  -- (0,6,0);
\draw[ dashed] (O)--(A) (O)--(B) (O)--(C);
  \end{scope}
\foreach \point/\position in {M/right,N/left,P/right,O/left};
\foreach \v in {A,B,C,O}  \draw[fill=black] (\v) circle (2pt);
\draw [fill opacity=0.4,fill=pink!80!blue] (A) -- (B) -- (C) -- cycle;
\end{tikzpicture}
\end{document} 

在此处输入图片描述

答案1

我会将它们添加到\foreach循环中:

在此处输入图片描述

笔记:

  • 我还建议您使用节点的名称作为名称,\coordinates以使事情变得更容易(正如我下面所做的那样)。

代码:

\documentclass[12pt,border=3]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{fouriernc}
\begin{document}

\newcommand\pgfmathsinandcos[3]{%
  \pgfmathsetmacro#1{sin(#3)}%
  \pgfmathsetmacro#2{cos(#3)}%
}

\begin{tikzpicture}[scale=1.5]

\pgfmathsetmacro\AngleFuite{135}
\pgfmathsetmacro\coeffReduc{.8}
\pgfmathsetmacro\clen{2}
\pgfmathsinandcos\sint\cost{\AngleFuite}

\begin{scope} [x     = {(\coeffReduc*\cost,-\coeffReduc*\sint)},
               y     = {(1cm,0cm)},
               z     = {(0cm,1cm)}]

\path coordinate (O) at (0,0,0)
      coordinate (M) at (0,5,0)
      coordinate (N) at (5,0,0)
      coordinate (P) at (0,0,5)
      coordinate (O) at (0,0,0)
      ;
\draw[thick,-stealth,blue]  (0,0,5)  -- (0,0,6);
\draw[thick,-stealth,red]   (5,0,0)  -- (6,0,0);
\draw[thick,-stealth,green] (0,5,0)  -- (0,6,0);
\draw[ dashed] (O)--(N) (O)--(M) (O)--(P);
  \end{scope}
\foreach \v/\position in {N/left,M/below,P/above right,O/left} {
    \draw[fill=black] (\v) circle (2pt) node [\position] {$\v$};
}
\draw [fill opacity=0.4,fill=pink!80!blue] (N) -- (M) -- (P) -- cycle;
\end{tikzpicture}
\end{document} 

相关内容