2

I am trying to draw a circle and its projection a plane. I can draw a circles on one plane an its projection on the other plane. Now i want to draw all possible perpendiculars from every circle's point to the corresponding point of the ellipsis. I know i can use

surface extrude(path3 p, path3 q);

after. There is a warning in the tutorial:

This can cause problems if the two paths do not have the same length (in the sense of path times); in general, this function should be used only with care.

but this is apparently not my case. My case is a little bit trickier. Here is a MWE

(Important: to compile it, use

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

option. This is how asypictureB works: it needs -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}

enter image description here

I am not sure, but it produces the picture above with

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

This looks strange and counter-intuitive for me. I think I should raise the circle UP, not DOWN. So I would understand if it were shift(Z*a*tan(VarPhi)) (with PLUS) instead of shift(-Z*a*tan(VarPhi)) (with MINUS). However, this doesn't produce the correct result with plus:

enter image description here

Question: Why doesn't the circle lay on the rotated plane, but in fact is higher than it?

It is visually parallel to the rotated plane, so there mistake is not in the rotation (rotate(angle=VarPhi, Y)), but in the shift (shift(-Z*a*tan(VarPhi))). What do I do wrong?

1
  • I am stupid. Just added rotate(angle=180, Y) to CircleProjection definition. The minor question is still up Jun 8, 2020 at 17:02

1 Answer 1

2

The whole point is that all trigonometric functions in asymptote need radians, but all rotation angles are in degrees. Taking care of it fixes the situation:

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .