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}
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:
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?
rotate(angle=180, Y)
to CircleProjection definition. The minor question is still up