三維曲線問題

三維曲線問題

我想指出 s 曲線的長度。以同樣的方式使用平滑演算法,但曲線看起來並不「平滑」:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
    [
        >=stealth,
        cm={-1,-1,1,0,(0,0)},
        x=3.85mm,
        z=-1cm, 
        axis/.style={-, black}, 
        vector/.style={-{Stealth[length=6,width=3]}, very thick, black}
    ] 

    \draw (0,0,0) node[left]{$O$};
    \draw[axis] (0,0,0) -- (4,0,0) node[left]{$X$};
    \draw[axis] (0,0,0) -- (0,4,0) node[right]{$Y$};
    \draw[axis] (0,0,0) -- (0,0,4) node[left]{$Z$};

    \draw[vector] (0,0,0) -- (1,1,2) node[circle,fill,inner    sep=0.7pt,label=left:$ A $](){};
    \draw (0.5,0.5,1) node[right]{$ \vec{r}_{0} $};
    \draw[vector] (0,0,0) -- (2.5,4,2.5) node[circle,fill,inner sep=0.7pt,label=right:$ B $](){};
    \draw (1.25,2,1.25) node[below]{$ \vec{r}(t) $};
    \draw[vector] (1,1,2) -- (2.5,4,2.5);
    \draw (1.75,2.25,2.25) node[below]{$ \Delta \vec{r} $};
    \draw [thick] plot [smooth, tension=1] coordinates { (1,1,2) (1.75,2.5,2.5) (2.5,4,2.5)};
    \draw [>=Bracket, <->] plot [smooth, tension=1] coordinates { (1,1,2.25) (1.75,2.5,2.75) (2.5,4,2.75)};
    \draw (1.75,2.5,2.5) node[above]{$ s $};
\end{tikzpicture}
\end{document}

結果如下:結果

答案1

好的,所以問題不在於座標或其他任何東西,而在於plot處理箭頭提示的路徑說明符,它在這裡介紹:平滑選項有時會在 PGF 圖中產生不正確的箭頭提示。 Jake 專門提供了一種向 PGF 圖添加箭頭提示的解決方案。

因為你使用的是 TikZ 它不會工作。但我有一個解決方法。首先,由於 的繪圖與Brackets下面的繪圖相同,因此應該使用該shift選項,使繪圖更加簡潔。好吧,現在我們知道添加箭頭提示時會出現問題,我們將簡單地繪製不帶提示並稍後添加它們:

\draw[>={Bracket[]}, postaction={<->, tips=true}, shift={(0,0,.25)}] plot[smooth,...

該鍵tips=true覆蓋了添加箭頭提示的規則,迫使 TikZ 添加箭頭,即使沒有繪圖。結果是:

在此輸入影像描述

微量元素

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
    [
        >=stealth,
        cm={-1,-1,1,0,(0,0)},
        x=3.85mm,
        z=-1cm, 
        axis/.style={-, black}, 
        vector/.style={-{Stealth[length=6,width=3]}, very thick, black}
    ] 

    \draw (0,0,0) node[left]{$O$};
    \draw[axis] (0,0,0) -- (4,0,0) node[left]{$X$};
    \draw[axis] (0,0,0) -- (0,4,0) node[right]{$Y$};
    \draw[axis] (0,0,0) -- (0,0,4) node[left]{$Z$};

    \draw[vector] (0,0,0) -- (1,1,2) node[circle,fill,inner    sep=0.7pt,label=left:$ A $](){};
    \draw (0.5,0.5,1) node[right]{$ \vec{r}_{0} $};
    \draw[vector] (0,0,0) -- (2.5,4,2.5) node[circle,fill,inner sep=0.7pt,label=right:$ B $](){};
    \draw (1.25,2,1.25) node[below]{$ \vec{r}(t) $};
    \draw[vector] (1,1,2) -- (2.5,4,2.5);
    \draw (1.75,2.25,2.25) node[below]{$ \Delta \vec{r} $};
    \draw [thick] plot [smooth, tension=1] coordinates { (1,1,2) (1.75,2.5,2.5) (2.5,4,2.5)};
    \draw [>={Bracket[]}, postaction={<->, tips=true}, shift={(0,0,.25)}] plot [smooth, tension=1] coordinates { (1,1,2) (1.75,2.5,2.5) (2.5,4,2.5) };
    \draw (1.75,2.5,2.5) node[above]{$ s $};
\end{tikzpicture}
\end{document}

相關內容