구에 경로의 접선 벡터 그리기

구에 경로의 접선 벡터 그리기

구에서의 병렬 전송을 설명하기 위해 접선 벡터와 법선 벡터를 그리려고 합니다. 경도와 위도 원이 있지만 벡터가 붙어 있습니다. 경로를 만드는 원의 각도에도 적응해야 합니다...

접선 벡터를 "시뮬레이트"하기 위해 더 큰 반경의 호를 속이고 사용했지만 이는 하나의 원에서만 작동합니다. 법선 벡터로 그림을 완성하는 것을 도와주실 수 있나요?

감사합니다 !

다음은 사진과 MWE입니다.

구형에서의 불완전한 병렬 전송

\documentclass[12pt]{article}
\usepackage{tikz}

\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%

\usetikzlibrary{positioning}


\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}

%Defining function to draw complete latitude circles 
\newcommand\DrawLongitudeCircle[2][1]{
    \LongitudePlane{\angEl}{#2}
    \tikzset{current plane/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)},scale=#1}}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
    \draw[current plane,thin,black] (\angVis:1) arc (\angVis:\angVis+180:1);
    \draw[current plane,thin,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}

%Defining function to draw limited longitude circles 
\newcommand\DrawLongitudeCirclered[2][1]{
    \LongitudePlane{\angEl}{#2}
    \tikzset{current plane/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)},scale=#1}}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
    \draw[current plane,red,thick] (90:1) arc (90:180:1);   
}


%Defining function to draw complete latitude circles 
\newcommand\DrawLatitudeCircle[2][1]{
    \LatitudePlane{\angEl}{#2}
    \tikzset{current plane/.prefix style={scale=#1}}
    \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
    \draw[current plane,thin,black] (\angVis:1) arc (\angVis:-\angVis-180:1);
    \draw[current plane,thin,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

%Defining function to draw limited latitude circles 
\newcommand\DrawLatitudeCirclered[2][1]{
    \LatitudePlane{\angEl}{#2}
    \tikzset{current plane/.prefix style={scale=#1}}
    \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
    \draw[current plane,red,thick] (\angPhiTwo:1) node[below right] {$$} arc (\angPhiTwo:\angPhiOne:1) node[below left] {$$}; %Point Q suivi du point P

    \foreach \r in {-130,-110,...,-50}{
    \draw[current plane,blue,ultra thick,->] (\r:1) arc (\r:\r+2:20);
    }
}

\tikzset{%
>=latex,
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\usepackage{amsmath}
\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{pgfplots}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}

\begin{document}
\begin{figure}[ht!]
\begin{tikzpicture}[scale=1,every node/.style={minimum size=1cm}]

%% some definitions
\def\R{4} % sphere radius

\def\angEl{25} % elevation angle
\def\angAz{-100} % azimuth angle
\def\angPhiOne{-130} % longitude of point P
\def\angPhiTwo{-50} % longitude of point Q
\def\angBeta{30} % latitude of point P and Q

%Sphere
\fill[ball color=white!10] (0,0) circle (\R); % 3D lighting effect

%Meridiens et équateur
\DrawLongitudeCircle[\R]{\angPhiOne} % pzplane
\DrawLongitudeCircle[\R]{\angPhiTwo} % qzplane
\DrawLatitudeCircle[\R]{0} % equator

%Poles nord et sud
\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\node[above=8pt] at (N) {$\mathbf{N}$};
\node[below=8pt] at (S) {$\mathbf{S}$};


%Trajectoires
\DrawLongitudeCirclered[\R]{180+\angPhiOne}
\DrawLongitudeCirclered[\R]{180+\angPhiTwo}
\DrawLatitudeCirclered[\R]{0}

\end{tikzpicture}
\end{figure}
\end{document}

답변1

turn도달한 마지막 점이 원점에 있도록 좌표계를 로컬로 이동하고 좌표계도 "회전"하여 x축이 마지막 점을 입력하는 접선 방향을 가리키도록 하는 좌표 옵션을 사용할 수 있습니다. .

\draw[current plane,blue,ultra thick,->] (\r:1) arc (\r:\r+2:20);다음과 같이 해키를 교체할 수 있습니다.

\draw[current plane,blue,ultra thick,->] (\r:1) -- ([turn]90:.5); % tangent vectors
\draw[current plane,red,->] (\r:1) -- ([turn]0:.5); % normal vectors

가지고 있는 것:

여기에 이미지 설명을 입력하세요

전체 MWE:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%

\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.style={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}

%Defining function to draw complete latitude circles 
\newcommand\DrawLongitudeCircle[2][1]{
    \LongitudePlane{\angEl}{#2}
    \tikzset{current plane/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)},scale=#1}}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
    \draw[current plane,thin,black] (\angVis:1) arc (\angVis:\angVis+180:1);
    \draw[current plane,thin,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}

%Defining function to draw limited longitude circles 
\newcommand\DrawLongitudeCirclered[2][1]{
    \LongitudePlane{\angEl}{#2}
    \tikzset{current plane/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)},scale=#1}}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
    \draw[current plane,red,thick] (90:1) arc (90:180:1);   
}


%Defining function to draw complete latitude circles 
\newcommand\DrawLatitudeCircle[2][1]{
    \LatitudePlane{\angEl}{#2}
    \tikzset{current plane/.prefix style={scale=#1}}
    \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
    \draw[current plane,thin,black] (\angVis:1) arc (\angVis:-\angVis-180:1);
    \draw[current plane,thin,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

%Defining function to draw limited latitude circles 
\newcommand\DrawLatitudeCirclered[2][1]{
    \LatitudePlane{\angEl}{#2}
    \tikzset{current plane/.prefix style={scale=#1}}
    \pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
    % angle of "visibility"
    \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
    \draw[current plane,red,thick] (\angPhiTwo:1) node[below right] {$$} arc (\angPhiTwo:\angPhiOne:1) node[below left] {$$}; %Point Q suivi du point P

    \foreach \r in {-130,-110,...,-50}{
    \draw[current plane,blue,ultra thick,->] (\r:1) -- ([turn]90:.5);
    \draw[current plane,red,->] (\r:1) -- ([turn]0:.5);
    }
}

\tikzset{%
>=latex,
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\usetikzlibrary{arrows}
\pagestyle{empty}
\usepackage{pgfplots}
\usetikzlibrary{calc,fadings,decorations.pathreplacing,positioning}
\pgfplotsset{compat=1.14}

\begin{document}
\begin{tikzpicture}[scale=1,every node/.style={minimum size=1cm}]
%% some definitions
\def\R{4} % sphere radius

\def\angEl{25} % elevation angle
\def\angAz{-100} % azimuth angle
\def\angPhiOne{-130} % longitude of point P
\def\angPhiTwo{-50} % longitude of point Q
\def\angBeta{30} % latitude of point P and Q

%Sphere
\fill[ball color=white!10] (0,0) circle (\R); % 3D lighting effect

%Meridiens et équateur
\DrawLongitudeCircle[\R]{\angPhiOne} % pzplane
\DrawLongitudeCircle[\R]{\angPhiTwo} % qzplane
\DrawLatitudeCircle[\R]{0} % equator

%Poles nord et sud
\pgfmathsetmacro\H{\R*cos(\angEl)} % distance to north pole
\coordinate[mark coordinate] (N) at (0,\H);
\coordinate[mark coordinate] (S) at (0,-\H);
\node[above=8pt] at (N) {$\mathbf{N}$};
\node[below=8pt] at (S) {$\mathbf{S}$};


%Trajectoires
\DrawLongitudeCirclered[\R]{180+\angPhiOne}
\DrawLongitudeCirclered[\R]{180+\angPhiTwo}
\DrawLatitudeCirclered[\R]{0}

\end{tikzpicture}
\end{document}

답변2

이것은 점근선 해법입니다(자세한 내용은이 링크).

여기에 이미지 설명을 입력하세요

// http://asymptote.ualberta.ca/
import three;
unitsize(1cm);
currentprojection=orthographic(1,1,.6,zoom=.9);
real r=3;
draw(scale3(r)*unitsphere,lightyellow+opacity(.6));
path3 circX=arc(O,r*Y,r*Y,normal=X);
path3 circY=arc(O,r*Z,r*Z,normal=Y);

path3 g=arc(O,r,90,0,90,360,normal=Z);
draw(g^^circX^^circY,blue+.6pt);

real[] t={0,.2,.4,.6,.8,1};
for(int i=0;i<t.length;++i){
triple P=point(g,t[i]);
triple Pt=dir(g,t[i]);           // the tangent vector at P
draw(P--P+1.5Pt,red,Arrow3);

// the normal vector at P of the planar curve g (in that plane)  
triple Pn=rotate(-90,normal(g))*Pt;  // in fact, normal(g)=Z  
draw(P--P+1.5Pn,orange,Arrow3);  
}  
  
dot("$N$",align=plain.N,r*Z);
dot("$S$",align=plain.S,-r*Z);

관련 정보