如何在路径上逆转时间

如何在路径上逆转时间

我正在尝试绘制一个圆,并在一个平面上投影。我可以在一个平面上绘制一个圆,在另一个平面上投影。现在我想从每个圆的点到椭圆的对应点绘制所有可能的垂线。我知道我可以使用

surface extrude(path3 p, path3 q);

之后。教程中有一个警告:

如果两条路径的长度不一样(就路径时间而言),则可能会引起问题;一般而言,应谨慎使用此功能。

但这显然不是我的情况。我的情况有点棘手。以下是 MWE

重要的:要编译它,请使用

pdflatex  -shell-escape -synctex=1 -interaction=nonstopmode %.tex

选项。这是 asypictureB 的工作方式:它需要-shell-escape):

\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{asypictureB}


%============================================================
\begin{document}




\begin{asypicture}{name=test}
defaultpen(fontsize(10pt));
settings.outformat = "pdf";
settings.prc = false;
settings.render = 16;
import three;
import solids;
size(3.8cm, 0);
currentprojection=orthographic((0,3,0));
//%============ Define objects =======
real VarPhi=40; //Angle of cutting plane
real a = 10; //The plane size

//Horizontal plane
path3 xyplane = (a,a,0)--(-a,a,0)--(-a,-a,0)--(a,-a,0)--cycle;

//Rotated plane
path3 xyplaneRotated = rotate(angle=-VarPhi, u=(a,a,0), v=(a,-a,0))*xyplane;

//Cylinder radius
real Radius = 5;

//Circle on the rotated plane
path3 CircleOriginal = shift(-Z*a*tan(VarPhi))*rotate(angle=VarPhi, Y)*circle(c=O, r=Radius, normal=Z); 

//Circle's projection = ellipse
path3 CircleProjection = rotate(angle=180, Y)*xscale3(cos(VarPhi))*circle(c=O, r=Radius, normal=Z);

//%============ Drawing ===================
//Axes
draw(O--10X, red);
draw(O--10Y, blue);
draw(O--10Z, green);

//Planes
draw(surface(xyplane),black+opacity(.1));
draw(xyplane,black+linewidth(.1));
draw(surface(xyplaneRotated),black+opacity(.1));
draw(xyplaneRotated,black+linewidth(.1));


//Circular bases
draw(CircleOriginal, red);
draw(CircleProjection, red);

//Surface
draw(extrude(CircleOriginal, CircleProjection),surfacepen=emissive(white));


\end{asypicture}

\end{document}

在此处输入图片描述

我不确定,但它会产生上面的图片

path3 CircleOriginal = shift(-Z*a*tan(VarPhi))*rotate(angle=VarPhi, Y)*circle(c=O, r=Radius, normal=Z); 

这对我来说看起来很奇怪,而且违反直觉。我认为我应该把圆圈向上抬高,而不是向下抬高。所以如果是shift(Z*a*tan(VarPhi))(带加号)而不是shift(-Z*a*tan(VarPhi))(带减号),我就能理解。然而,这并不能产生正确的结果:

在此处输入图片描述

问题:为什么圆不位于旋转的平面上,但实际上却高于它?

从视觉上看,它与旋转后的平面平行,因此错误不在于旋转 ( rotate(angle=VarPhi, Y)),而在于平移 ( shift(-Z*a*tan(VarPhi)))。我做错了什么?

答案1

关键在于,渐近线中的所有三角函数都需要弧度,但所有旋转角度都是以度为单位。处理这个问题可以解决这个问题:

\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{asypictureB}


%============================================================
\begin{document}




\begin{asypicture}{name=test}
defaultpen(fontsize(10pt));
settings.outformat = "pdf";
settings.prc = false;
settings.render = 16;
import three;
import solids;
size(3.8cm, 0);
currentprojection=orthographic((0,3,0));
//%============ Define objects =======
real VarPhi=40*pi/180;
real a = 10;

path3 xyplane = (a,a,0)--(-a,a,0)--(-a,-a,0)--(a,-a,0)--cycle;
path3 xyplaneRot = (a,a,0)--(-a-2,a,0)--(-a-2,-a,0)--(a,-a,0)--cycle;
path3 xyplaneRotated = rotate(angle=-VarPhi*180/pi, u=(a,a,0), v=(a,-a,0))*xyplaneRot;

real Radius = 5;
path3 CircleOriginal = shift(Z*a*tan(VarPhi))*rotate(angle=VarPhi*180/pi, Y)*circle(c=O, r=Radius, normal=Z); 
path3 CircleProjection = xscale3(cos(VarPhi))*circle(c=O, r=Radius, normal=Z);

//%============ Drawing ===================
//Axes
draw(O--10X, red);
draw(O--10Y, blue);
draw(O--10Z, green);

//Planes
draw(surface(xyplane),black+opacity(.1));
draw(xyplane,black+linewidth(.1));
draw(surface(xyplaneRotated),black+opacity(.1));
draw(xyplaneRotated,black+linewidth(.1));


//Circular bases
draw(CircleOriginal, red);
draw(CircleProjection, red);

//Surface

draw(CircleOriginal, red);
draw(CircleProjection, red);

draw(extrude(CircleOriginal, CircleProjection),surfacepen=grey+opacity(0.3));


\end{asypicture}

\end{document}

在此处输入图片描述

相关内容