使用 Tikz 的 3D 几何

使用 Tikz 的 3D 几何

我使用以下代码来生成二维几何图形:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}
\begin{document}
\begin{figure}[hbt]
\centering
\begin{tikzpicture}[scale=350]
\centering
\draw[blue,thick] (0,0) -- (0.0219837,0)-- (0.0219837,0.0168148)-- (0.0056579,0.0168148) -- (0.0052959,0.0127) -- (0.0027051,0.0127) -- (0.0027051,0.0142494)--(0,0.0142494) -- cycle;
\filldraw[fill=green!20,draw=green!50!black] (0,0) -- (0.0219837,0)-- (0.0219837,0.0168148)-- (0.0056579,0.0168148) -- (0.0052959,0.0127) -- (0.0027051,0.0127) -- (0.0027051,0.0142494)--(0,0.0142494) -- cycle;
\end{tikzpicture}
\caption{domain.}
\end{figure}
\end{document}

得出:

在此处输入图片描述

**

  • 问题:我想通过以下方法将二维几何图形扩展到三维:30 度基于最左边的垂直线的旋转,即像30 度楔形为轮廓。此外,我想添加一个较小的楔形,边缘圆润(橙色轮廓-也是 30 度)如下图所示:

在此处输入图片描述

顶视图:

在此处输入图片描述

**:

还,如何将 3D 几何图形放入绘图模式如下? 在此处输入图片描述

提前感谢您的时间。任何见解和帮助都将不胜感激。

答案1

这是您上一个模型的示例。它需要3dperspective库。3d您可以使用更改canvas并在垂直或水平平面之一中绘制。对于小楔形,您可以执行shift坐标原点的绘制,然后执行\clip。为了简单起见,我更改了您的数字。

像这样:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}

\begin{document}
\begin{tikzpicture}[isometric view,rotate around z=-65,
                    line join=round,line cap=round]
  \foreach\i in {0,-30}
    \draw[rotate around z=\i,canvas is xz plane at y=0]
      (0,0) -| (10,8) -- (2.5,8) -- (2.3,6) -| (1.3,7) -| cycle;
  \foreach\i/\j in {10/0,10/8,2.5/8,2.3/6,1.3/6,1.3/7}
    \draw[canvas is xy plane at z=\j] (0:\i) arc (0:-30:\i);
  % this prevents the circle clip from widening the bounding box
  \useasboundingbox (current bounding box.north west) -- (current bounding box.south east);
  %
  \begin{scope}[canvas is xy plane at z=7]
    \clip (0,0) circle [radius=1.3];
    \draw[shift={(-15:0.7)},rounded corners] (0,0) -- (-30:1) arc (-30:0:1) -- cycle;
  \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述 编辑:现在有一个可靠的:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}

% colors
\definecolor{side}    {HTML}{879EA4}
\definecolor{top}     {HTML}{AAC7CF}
\definecolor{myorange}{HTML}{EA8032}

\begin{document}
\begin{tikzpicture}[isometric view,rotate around z=-10,
                    line join=round,line cap=round]
  \begin{scope}[canvas is xy plane at z=7]
    \draw[fill=top] (0,0) -- (-30:1.3) arc (-30:0:1.3) -- cycle;
    \clip (0,0) -- (-30:1.3) arc (-30:0:1.3) -- cycle;
    \draw[shift={(-15:0.7)},rounded corners,fill=myorange] (0,0) -- (-30:1) arc (-30:0:1) -- cycle;
  \end{scope}
  \draw[canvas is xy plane at z=6,fill=top] 
    (-30:1.3) arc (-30:0:1.3) -- (0:2.3) arc (0:-30:2.3) -- cycle;
  \draw[canvas is xy plane at z=8,fill=top]
    (-30:2.5) arc (-30:0:2.5) coordinate (1) -- (0:10) arc (0:-30:10) -- cycle;
  \draw[canvas is xy plane at z=6,fill=side,fill=side]
    (-30:2.3) arc (-30:0:2.3) -- (1) arc (0:-30:2.5) -- cycle;
  \draw[rotate around z=-30,canvas is xz plane at y=0,fill=side]
    (0,0) -| (10,8) -- (2.5,8) -- (2.3,6) -| (1.3,7) -| cycle;
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容