10 请问这种图形怎么用Tikz画出来

发布于 2023-03-05 16:54:44
关注者
0
被浏览
1.1k
寄存器
寄存器 2023-03-06
这家伙很懒,什么也没写!

可以用tkz-euclide宏包实现,在此,参数是凑出来的,可以根据需要再调整一下。

% 引入文档类
\documentclass[margin=5pt]{standalone}
% 导言区
\usepackage{tkz-euclide}

% 正文区
\begin{document}

\def\neg{-35}
\def\pos{10}
% 圆角立方体
\begin{tikzpicture}[%
  pol/.style={fill=yellow!40,opacity=.5},
  seg/.style={dotted},
  scale=2]
  \tkzDefPoint(0,0){A}
  \tkzDefShiftPoint[A](\neg:2.5){B}
  \tkzDefShiftPoint[A](\pos:3.5){D}
  \tkzDefShiftPoint[A](90:2){F}
  \tkzDefShiftPoint[D](90:2){H}
  \tkzDefLine[parallel=through D](A,B) \tkzGetPoint{I1}
  \tkzDefLine[parallel=through B](A,D) \tkzGetPoint{I2}
  \tkzInterLL(D,I1)(B,I2)
  \tkzGetPoint{C}
  \tkzDefLine[parallel=through F](A,B) \tkzGetPoint{I1}
  \tkzDefLine[parallel=through B](A,F) \tkzGetPoint{I2}
  \tkzInterLL(F,I1)(B,I2)
  \tkzGetPoint{E}
  \tkzDefLine[parallel=through H](F,E) \tkzGetPoint{I1}
  \tkzDefLine[parallel=through E](B,C) \tkzGetPoint{I2}
  \tkzInterLL(H,I1)(E,I2)
  \tkzGetPoint{G}

  \tkzDefPointOnLine[pos=0.086](A,D)\tkzGetPoint{A'}
  \tkzDefLine[parallel=through A'](A,F) \tkzGetPoint{I1}
  \tkzInterLL(A',I1)(F,H)
  \tkzGetPoint{F'}
  \tkzDefPointOnLine[pos=1.15](A',F')\tkzGetPoint{F''}

  \tkzDefLine[parallel=through A'](A,B) \tkzGetPoint{I1}
  \tkzInterLL(A',I1)(B,C)
  \tkzGetPoint{B'}

  \tkzDefLine[parallel=through B'](A',F') \tkzGetPoint{I1}
  \tkzInterLL(B',I1)(E,G)
  \tkzGetPoint{E'}

  \tkzDefLine[parallel=through F''](F,E) \tkzGetPoint{I1}
  \tkzInterLL(F'',I1)(B',E')
  \tkzGetPoint{E''}

  \tkzDefLine[parallel=through F''](A,D) \tkzGetPoint{I1}
  \tkzInterLL(F'',I1)(D,H)
  \tkzGetPoint{H''}

  \tkzDefLine[parallel=through E''](B,C) \tkzGetPoint{I1}
  \tkzInterLL(E'',I1)(C,G)
  \tkzGetPoint{G''}

  \tkzDefPointOnLine[pos=1.12](A',B')\tkzGetPoint{B''}

  \tkzDefLine[parallel=through B''](B,C) \tkzGetPoint{I1}
  \tkzInterLL(B'',I1)(D,C)
  \tkzGetPoint{C''}

  \tkzDefLine[parallel=through B''](B,E) \tkzGetPoint{I1}
  \tkzInterLL(B'',I1)(F',E')
  \tkzGetPoint{B'''}

  \tkzDefLine[parallel=through C''](C,G) \tkzGetPoint{I1}
  \tkzInterLL(C'',I1)(H,G)
  \tkzGetPoint{C'''}

  \tkzDefPointOnLine[pos=0.04](A,B)\tkzGetPoint{T0}
  \tkzDefPointOnLine[pos=-0.014](B,C)\tkzGetPoint{T1}

  \tkzDefLine[parallel=through T1](A,B) \tkzGetPoint{I1}
  \tkzInterLL(T1,I1)(A,D)
  \tkzGetPoint{A''}

  \tkzDefPointOnLine[pos=1.018](A',B'')\tkzGetPoint{T2}

  \tkzDefLine[parallel=through T2](B,C) \tkzGetPoint{I1}
  \tkzInterLL(T2,I1)(D,C)
  \tkzGetPoint{T4}
  \tkzDefPointOnLine[pos=0.96](T2,T4)\tkzGetPoint{T3}

  \tkzDefPointOnLine[pos=-0.5](F,F')\tkzGetPoint{P}
  \tkzDefPointOnLine[pos=0.75](A,F')\tkzGetPoint{P'}

  \tkzDefPointOnLine[pos=1.32](D,G)\tkzGetPoint{M}
  \tkzDefPointOnLine[pos=0.65](C''',G'')\tkzGetPoint{N}

  \tkzDrawPolygon(A,B,E,F)
  \tkzDrawPolygon(B'',C'',C''',B''')
  \tkzDrawPolygon(F'',E'',G'',H'')
  \tkzFillPolygon[pol](B,B',E',E)
  \tkzDrawSegments[add = -0.05 and 0.082](A'',T1)
  \tkzDrawSegments[add = 0.065 and -0.04](T2,T4)
  \tkzDrawPolygon[seg](B,C,G,E)
  \tkzDrawSegments[seg](A,A' A',B' A',F' B',E' B,C F,F' E',F' F',F'' E',E'')
  \tkzDrawSegments[seg,dim={\(\varepsilon\),0.1cm,left=1mm}](F',F'')
  \tkzDrawSegments[seg](C,G'')
  \tkzDrawSegments[seg](B',B'' C,C'' E',B''' G,C''')

  \tkzDrawSegments[->](P,P' M,N)
  \tkzLabelPoint[left,above](P){$P$}
  \tkzLabelPoint[right,above](M){$C$}

  \tkzDefShiftPoint[F'](-40:0.10){F'''}
  \tkzDrawArc(F''',F'')(F)
  \tkzDefShiftPoint[E'](-40:0.10){F'''}
  \tkzDrawArc(F''',E'')(E)
  \tkzDefShiftPoint[E'](-152:0.25){F'''}
  \tkzDrawArc(F''',B''')(E'')
  \tkzDefShiftPoint[G](-152:0.25){F'''}
  \tkzDrawArc(F''',C''')(G'')
  \tkzDefShiftPoint[E'](78:0.85){E'''}
  \tkzDrawArc(E''',E)(B''')
  \tkzDefShiftPoint[A'](78:0.11){A'''}
  \tkzDrawArc(A''',A)(T0)

  \tkzDefShiftPoint[B'](78:0.85){X}
  \tkzDrawArc[red](X,B)(B'')
  \tkzDefShiftPoint[B'](78:0.14){Y}
  \tkzDrawArc[blue](Y,B)(B'')

  \tkzDefShiftPoint[T3](125:2.54){T'}
  \tkzDrawArc(T',T3)(C'')
\end{tikzpicture}

\end{document}

另外,由于要忙别的事了,下面那个小圆角没有填充,可以阅读手册,添加填充代码。
image.png

2 个回答
其实有点卡
其实有点卡 2023-03-05
这家伙很懒,什么也没写!

这三个图形,单个画都没有问题,但是要自动处理它们之间的关联性,恐怕 tikz 做不了。也许一种编程能力强的绘图语言可以做,比如 asymptote,但恐怕也得写上个几百上千行代码。

这样的需求不如使用其他专业的软件吧,tikz 做不了(个人见解)。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览