
Ich möchte eine normale Begrenzungslinie zu einer Fläche in einem Punkt zeichnen.
Die Oberfläche ist y=x
und der Punkt ist (1/2,1/2,1)
. Die Steigung ist (-1,1,0)
, und am Punkt (1/2,1/2,1)
ist immer noch dieselbe, daher wäre die Normallinie (x-1/2)/(-1)=(y-1/2)/(1)=(z-1)/(0)
, daher wird die Linie durch beschrieben (.5,.5,1)+t(-1,1,0)
.
Ich möchte jedoch, dass die Zeilebegrenzt, um eineEinheitsdirektor-Vektor, aber ich kann das nicht machen. Ich verwende t
zwischen 0
und 1
, aber diese zeichnen eine lange Linie; ich möchte, dass es ein Vektor von istLänge1
.
Ich bin nicht sicher, ob diese Mathematik richtig ist. Wenn ich den Einheitsvektor davon finde, (-1,1,0)
also (-1,1,0)/(sqrt(2))
habe (-sqrt(2)/2,sqrt(2)/2,0)
ich immer noch keinen Vektor der Länge1
(wenn t
zwischen 0
und liegt 1
).
Hier ist mein 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}
Auch die Linie hat eine schlechte Qualität, sie sieht pixelig aus:
Weiß jemand, wie man einen Vektor der Länge erzeugt, 1
oder was übersehe ich?
Einige interessante Links:
pgfplots
: Positionierung eines Normal- und Tangentialvektors auf einer 3D-Oberfläche- Finden Sie eine gute Ansicht für eine Funktion nach Teilen mithilfe
tikzpicture
der Umgebung [Overleaf]
Danke!!
Antwort1
Ich hoffe, ich übersehe nichts Offensichtliches. Sie müssen in Ihrem linken Beispiel nur durch dividieren, sqrt(2)
um zu erhalten:
\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}
Die "Pixelbildung" verschwand nach dem Hinzufügensamples y=0
.