三维曲线问题

三维曲线问题

我想指示 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说明符处理箭头提示,它在这里介绍:平滑选项有时会在 PGFplots 中产生错误的箭头提示。Jake 专门提供了一种向 PGFplots 添加箭头提示的解决方案。

由于您使用的是 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}

相关内容