带弧形边缘的立方体

带弧形边缘的立方体

嘿伙计们,我想知道如何获得这种弯曲的边缘

我想要弧形边缘

在我在这里画的立方体中:

        \usepackage{tikz}
        \usetikzlibrary{calc}
        \begin{tikzpicture}
        \coordinate(O) at (1.5,1.5,1.5);
        \foreach \i/\n/\j/\k/\l in {0/1/4/5/8, 1/2/3/6/7} {
            \coordinate(\n) at (3*\i, 0, 3);
            \coordinate(\j) at (3*\i, 3, 3);
            \coordinate(\k) at (3*\i, 0, 0);
            \coordinate(\l) at (3*\i, 3, 0);
        }
        \coordinate(9)  at ($(1)!.5!(2)$);
        \coordinate(10) at ($(2)!.5!(3)$);
        \coordinate(11) at ($(3)!.5!(4)$);
        \coordinate(12) at ($(4)!.5!(1)$);
        \coordinate(13) at ($(2)!.5!(6)$);
        \coordinate(14) at ($(6)!.5!(5)$);
        \coordinate(15) at ($(5)!.5!(1)$);
        \coordinate(16) at ($(5)!.5!(8)$);
        \coordinate(17) at ($(8)!.5!(7)$);
        \coordinate(18) at ($(6)!.5!(7)$);
        \coordinate(19) at ($(3)!.5!(7)$);
        \coordinate(20) at ($(4)!.5!(8)$);

        \foreach \i/\Position in {1/below left, 2/below right, 3/below right, 4/above left, 5/below right, 6/below right, 7/above right, 8/above left} %
        {\fill (\i) circle (1.5pt) node [\Position] {\tiny \i}}
        \foreach \i/\Position in {9/below left, 10/right, 11/above, 12/above left, 13/below right, 14/below left, 15/above left, 16/below left, 17/above, 18/right, 19/above left, 20/above left} %
        {\fill (\i) circle (1.5pt) node [\Position] {\tiny \i}};
        \draw[thick](1)--(2)--(3)--(4)--cycle;
        \draw[thick](2)--(3)--(7)--(6)--cycle;
        \draw[thick](3)--(4)--(8)--(7)--cycle;
        \draw[dashed](8)--(5)--(1);
        \draw[dashed](5)--(6);
        \draw [->] (O) -- ($(2)!.5!(7)$) node [below] {\tiny $\eta$};
        \draw [->] (O) -- ($(2)!.5!(4)$) node [above] {\tiny $\xi$};
        \draw [->] (O) -- ($(4)!.5!(7)$) node [left] {\tiny $\chi$};
        \end{tikzpicture}

我也想用 foreach (用于坐标)循环优化代码,但我不知道如何设置它们

答案1

一些非常快速的书写更改。本质上你想使用

 \draw (<start>) to[bend left] coordinate (<coordinate in the middle) (<end>);

MWE(可以进一步优化):

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
        \begin{tikzpicture}
        \coordinate(O) at (1.5,1.5,1.5);
        \foreach \i/\n/\j/\k/\l in {0/1/4/5/8, 1/2/3/6/7} {
            \coordinate(\n) at (3*\i, 0, 3);
            \coordinate(\j) at (3*\i, 3, 3);
            \coordinate(\k) at (3*\i, 0, 0);
            \coordinate(\l) at (3*\i, 3, 0);
        }
        \draw[dashed](1)to[bend right=10] coordinate (15)
            (5)to[bend right=10] coordinate (14) (6);
        \draw[dashed](5)to[bend right=10] coordinate (16)(8);
        \draw[thick](1)to[bend right=10] coordinate (9) (2)
         to[bend right=10] coordinate (10) (3)
         to[bend right=10] coordinate (11) (4)
         to[bend right=-10] coordinate (12) cycle;
        \draw[thick](2)to[bend right=10] coordinate (13)(6)
        to[bend right=10] coordinate (18) (7)
        to[bend right=10] coordinate (19) (3);
        \draw[thick](7)to[bend right=10] coordinate (17) (8)
            to[bend right=10] coordinate (20)  (4);

        \foreach \i/\Position in {1/below left, 2/below right, 3/below right, 4/above left, 5/below right, 6/below right, 7/above right, 8/above left} %
        {\fill (\i) circle (1.5pt) node [\Position] {\tiny \i};}
        \foreach \i/\Position in {9/below left, 10/right, 11/above, 12/above left, 13/below right, 14/below left, 15/above left, 16/below left, 17/above, 18/right, 19/above left, 20/above left} %
        {\fill (\i) circle (1.5pt) node [\Position] {\tiny \i};}
        \draw [->] (O) -- ($(2)!.5!(7)$) node [below] {\tiny $\eta$};
        \draw [->] (O) -- ($(2)!.5!(4)$) node [above] {\tiny $\xi$};
        \draw [->] (O) -- ($(4)!.5!(7)$) node [left] {\tiny $\chi$};
        \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容