使用 PGFPlots 使用酉導向向量繪製參數線會產生更長的直線

使用 PGFPlots 使用酉導向向量繪製參數線會產生更長的直線

我想在一個點的表面上繪製一條正常的有界線。

面為y=x,點為(1/2,1/2,1)。梯度為(-1,1,0),且在點(1/2,1/2,1)仍然相同,因此法線為(x-1/2)/(-1)=(y-1/2)/(1)=(z-1)/(0),因此該線由 描述(.5,.5,1)+t(-1,1,0)

但是,我希望該行是有界的,為了製作一個酉向量,但我無法做到這些。我在和t之間使用,但它們畫了一條很長的線;我希望它是一個向量01長度1

我不確定這個數學是否正確。如果我發現它的酉向量(-1,1,0)(-1,1,0)/(sqrt(2))ie(-sqrt(2)/2,sqrt(2)/2,0)那麼我仍然沒有長度向量1(當t0和之間時1)。

這是我的 MWE:

\documentclass{article}
\usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}

\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}

\begin{center}
    \begin{tikzpicture}
        \begin{axis} [
                title={Without normalizing $(-1,1,0)$ ($t\in[0,1]$)},
                axis on top,
                axis lines=center,
                xlabel=$x$,
                ylabel=$y$,
                zlabel=$z$,
                ticklabel style={font=\tiny},
                view={115}{25}
            ]
            \addplot3[opacity=.5,surf,samples=21,variable=\t,variable y=\s,domain=0:2,y domain=0:90,z buffer=sort,colormap={red}{color=(red) color=(red)}] ({\t*cos(\s)*(sqrt(2)*.5)},{\t*cos(\s)*(sqrt(2)*.5)},{\t*sin(\s)});%Red S
            \addplot3[-stealth,variable=\t,domain=0:1] ({1/2+t},{1/2-t},{1});
        \end{axis}
    \end{tikzpicture}
    \hfill
    \begin{tikzpicture}
        \begin{axis} [
                title={Normalizing $(-1,1,0)$ ($t\in[0,1]$)},
                axis on top,
                axis lines=center,
                xlabel=$x$,
                ylabel=$y$,
                zlabel=$z$,
                ticklabel style={font=\tiny},
                view={115}{25}
            ]
            \addplot3[opacity=.5,surf,samples=21,variable=\t,variable y=\s,domain=0:2,y domain=0:90,z buffer=sort,colormap={red}{color=(red) color=(red)}] ({\t*cos(\s)*(sqrt(2)*.5)},{\t*cos(\s)*(sqrt(2)*.5)},{\t*sin(\s)});%Red S
            \addplot3[-stealth,variable=\t,domain=0:1] ({1/2+(sqrt(2)/2)*t},{1/2-(sqrt(2)/2)*t},{1});
        \end{axis}
    \end{tikzpicture}
\end{center}

\end{document}

微量元素

即使這條線的品質很差,它看起來也是像素化的:

像素化線

有誰知道如何產生長度向量1或我缺少什麼?

一些感興趣的連結:

謝謝!

答案1

我希望我沒有遺漏任何明顯的東西。您只需sqrt(2)在左側範例中除以即可得出

\documentclass{article}
\usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}

\usepackage{pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}

\begin{center}
    \begin{tikzpicture}
        \begin{axis} [
                title={Normalizing},
                axis on top,
                axis lines=center,
                xlabel=$x$,
                ylabel=$y$,
                zlabel=$z$,
                ticklabel style={font=\tiny},
                view={115}{25}
            ]
            \addplot3[opacity=.5,surf,samples=21,variable=\t,variable y=\s,domain=0:2,y domain=0:90,z buffer=sort,colormap={red}{color=(red) color=(red)}] ({\t*cos(\s)*(sqrt(2)*.5)},{\t*cos(\s)*(sqrt(2)*.5)},{\t*sin(\s)});%Red S            
            \pgfmathsetmacro{\msq}{sqrt(1/2)}
            \addplot3[-stealth,variable=\t,samples at={0,\msq},samples y=0] ({1/2+t},{1/2-t},{1});
        \end{axis}
    \end{tikzpicture}
\end{center}
\end{document}

在此輸入影像描述

添加後“像素化”消失了samples y=0

相關內容