与圆柱相切的平面

与圆柱相切的平面

我正在尝试制作这张图表 在此处输入图片描述

与我原来的问题相比,我已经取得了一些进展,但我不知道如何将部分涂成蓝色,这是我与代码一起获得的结果 在此处输入图片描述

settings.render=8;
import three;
import solids;
import bsp;
import graph3;
size (5cm,0);

draw(unitsphere, rgb(0,0.6,0.8) + opacity(.95));

path3 xyplane = path3(scale(1) * box((-1.5,-1.5),(1,0)));
real a=1/(4sqrt(2));
real b=1/(4sqrt(2));
real long=3.3;
real y0=0.28;
real m=180*atan(b/sqrt(y0*y0-a*a))/pi;
real rotY=4;
real rotZ=65;
real rotXY=-10;

draw(surface(rotate(rotXY,X-Y) * rotate(rotY,Y)*rotate(rotZ,Z)*rotate(m,X)*xyplane),surfacepen=gray,black + opacity(1));

draw(surface(rotate(rotXY,X-Y) * rotate(rotY,Y)*rotate(rotZ,Z)*rotate(-m,X)*xyplane),surfacepen=lightgray,black+opacity(1));

surface cylinderSurfaceTiltedPlane(real a, real b, real z0, real y0) {
    triple parametricCylinder(pair p) {
        real Phi = p.x;
        real Z = p.y;
        real x = Z;
        real y = a*cos(Phi)-y0;
        real z = b*sin(Phi);
        return (x,y,z);
    }
    return surface(parametricCylinder, (0,-3*z0/4), (2pi,13*z0/20), Spline);
}
surface cF =  rotate(rotXY,X-Y) * rotate(rotY,Y)*rotate(rotZ,Z) * cylinderSurfaceTiltedPlane(a, b, long, y0);
draw(cF,rgb(255/255,195/255,0/255));

triple f(real t) {
return (cos(t)*cos(0), cos(t)*sin(0), sin(t));
}
path3 circ = graph(f, 0, 2pi, operator ..);
draw(rotate(rotXY,X-Y) * rotate(75+90,Z)*circ,black + 0.1pt);
draw(rotate(rotXY,X-Y) * rotate(75,Z)*circ,black + 0.1pt);

triple g(real t) {
return (cos(t), sin(t),0);
}
path3 cir = graph(g, 0, 2pi, operator ..);
draw(rotate(rotXY,X-Y) * rotate(rotY,Y)*rotate(rotZ,Z)*cir,black + 0.1pt);

我试图让它变得非常通用,因为通过移动参数,每个参数都可以以所需的视角生成所需的结果。但正如我提到的,我不知道如何着色,我曾尝试使用这个: 在此处输入图片描述

代码:

import three;
settings.render=8;
size(5cm);
//currentprojection=perspective(50,80,50);

draw(unitsphere, rgb(0,0.6,0.8) + opacity(.95));
triple A=(0.98,-0.17,0.14);
triple MAB=(0,-0.78,0.64); //mid-edge (AB)
triple B=(-0.98,-0.17,0.14);
triple MBC=(-0.89,-0.46,0); //mid-edge
triple C=(-0.98,-0.17,-0.14);
triple MAC=(0,-0.98,0.2); // mid-edge

path3 gc1=(A..MAB..B); //to avoid computation
path3 gc2=(B..(-0.93,-0.33,0.18)..MBC); // I use asymptote path3 routine
path3 gc3=(MBC..MAC..A);
// I recover the different tangents in A, B, C 
// to construct a cycle-path3 of length 3.
path3 gc=point(gc1,0){dir(gc1,0)}..{dir(gc1,2)}point(gc1,2){dir(gc2,0)}
..{dir(gc2,2)}point(gc2,2){dir(gc3,0)}..{dir(gc3,2)}point(gc3,2)..cycle;

draw(surface(patch(gc)),blue);

draw(gc1^^gc2^^gc3);
//dot((gc1^^gc2^^gc3),red);

但正如你所看到的,它只覆盖了一部分,计算点数以使一切顺利实在是太费力了,起初我想着修补它直到它出来,但经过几个小时的尝试我放弃了。

原始问题 圆柱体必须以 为中心(*,-1/3,0),这样圆柱体就必须与轴平行x。当平面与圆柱体相切并在 yz 平面上看到时,我们有这样的图 在此处输入图片描述在此处输入图片描述

答案1

也许是这样的? 在此处输入图片描述

我正在使用 TiZ 3d 和等距透视。有几个简化。一些点是通过在球体上反复试验找到的(如果您看到的角度不是 15 的倍数,那就是其中之一),因为要准确地找到它们对数学部门来说会非常繁重。然后,圆柱体和球体相交的后曲线几乎位于球体边界上,因此没有绘制。

这是代码:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{3d,perspective}

\tikzset
{
  cylinder/.style={thick,bottom color=magenta!80!black,top color=white,shading angle=-30},
  inside/.style={thick,bottom color=gray!20,top color=gray!80,shading angle=-30},
  sphere/.style={thick,ball color=blue,fill opacity=0.4},
  plane/.style={thick,fill=orange,fill opacity=0.7},
}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,
                    isometric view,rotate around z=180,rotate around x=90]
  \pgfmathsetmacro\a{asin(0.5)} % planes angle
  % bottom plane
  \draw[plane] (0,0,-4) {[rotate around z=-\a,canvas is xz plane at y=0] arc (-90:16:4)} --
               (218:4cm) arc (218:150:4cm) -- (0,0,6) --++ (-\a:6) --++ (0,0,-12) -- (0,0,-6) -- cycle;
  % cylinder, back and inside
  \draw[cylinder] (2,0,6) + (135:1) arc (135:-45:1) --
                  ({2+cos(315)},{sin(315)},{-sqrt(11-4*cos(315))}) --
                   plot[domain=-45:135,samples=91] ({2+cos(\x)},{sin(\x)},{-sqrt(11-4*cos(\x)}) -- cycle;
  % top plane, inside
  \fill[plane] (150:4cm) arc (150:159:4cm)
      {[rotate around z= \a,canvas is xz plane at y=0] arc (54:-90:4)} -- cycle;
  \draw[thick,rotate around z=\a,canvas is xz plane at y=0] (0,4) arc (90:54:4);
  \draw[thick] (150:4cm) -- (0,0,-4);
  % sphere
  \draw[sphere] (0,0,0) circle (4cm);     
  % cylinder, front
  \draw[cylinder] (2,0,-6) + (135:1) arc (135:-45:1) --
                  ({2+cos(315)},{sin(315)},{-sqrt(11-4*cos(315))}) --
                   plot[domain=-45:135,samples=91] ({2+cos(\x)},{sin(\x)},{-sqrt(11-4*cos(\x)}) -- cycle;
  \draw[canvas is xy plane at z=-6,inside] (2,0) circle (1);
  % top plane, outside
  \draw[plane] (150:4cm) -- (0,0,6) --++ (\a:6) --++ (0,0,-12) -- (0,0,-6) -- (0,0,-4)
    {[rotate around z=\a,canvas is xz plane at y=0] arc (-90:54:4)} -- (159:4 cm)  arc (159:150:4cm);
\end{tikzpicture}
\end{document}

相关内容