이차 형태를 사용하여 원통 그리기

이차 형태를 사용하여 원통 그리기

그래서 원통을 그리는 방법을 찾아봤는데 방법을 찾을 수 없는 것 같습니다. pgfplots를 사용하여 그릴 수 있도록 다음 암시적 함수에서 좌표를 어떻게 얻을 수 있습니까? 아니면 행렬 형식을 사용하여 플롯할 수 있는 방법이 있나요?

$$1=q(x,y,z)=(x,y,z) \begin{bmatrix}
2& -1 & -1\\
-1 & 2 & -1\\
-1 &-1 &2
\end{bmatrix} (x,y,z)^T$$

답변1

이러한 종류의 무한히 확장되는 축퇴 타원체를 매개변수화할 수 있습니다(이것은 수학입니다!). 나는 당신을 위해 이것을했습니다.

플롯 사이의 가짜 3D를 처리하려면 원통을 두 번 그려야 합니다."내부에"실린더.

실린더 하나를 빼는 연습으로 남겨두겠습니다.

출력

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

코드

\documentclass[12pt,tikz,border=0pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset%{{{
{
  mySurface/.style = 
  {
    mesh, % there should be better options : look at the PGFplots manual
    opacity=.1, 
  }
}
%}}}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    [
      %{{{
      width=30cm,
      xticklabels=\empty,
      yticklabels=\empty,
      zticklabels=\empty,
      samples = 2, % for the lines
      samples y = 100, % for the circles
      % limits of the box
      xmin = -12, xmax = 12, 
      ymin = -12, ymax = 12,
      zmin = -12, zmax = 12,
      unit vector ratio = 1 1 1,
      % parametrize the 3d view
      view/az=15,
      view/h=80,
      %length of the cylinder
      domain = -8:8,
      %}}}
    ]
    \def\X{\r*cos(y)-\r*sin(y) + x}
    \def\Y{-\r*cos(y)-\r*sin(y) + x}
    \def\Z{2 * \r*sin(y) + x}
    \def\r{2}
    \addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
    \def\r{1}
    \addplot3[mySurface,domain y= 90:270] ({\X},{\Y},{\Z});
    \addplot3[domain=-12:12, samples=2, blue, thick] (x,x,x);
    \addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
    \def\r{2}
    \addplot3[mySurface,domain y= -90:90] ({\X},{\Y},{\Z}); ;
  \end{axis}
\end{tikzpicture}
\end{document}

관련 정보