その他一覧へ戻る

3D座標

鉄TeX機能紹介/TikZサンプル/3D座標.tex鉄TeX機能紹介 / TikZhybrid

レンダリング結果

1ページ / 同名PDFあり
3D座標 preview
PDFを開く
TeXソース
TeXソース
入力コード
\documentclass[b5j,10pt,twoside]{tetsujsarticle}
\usepackage{tetsuryoku}
\pagestyle{fancy}

\余白設定[
上余白=1truecm,
下余白=上余白,
左余白=1.414truecm,
左右差=0truecm,
段間隔=対称,
段組の仕切り線の太さ=.5truept,
ヘッダの縦幅=16truept,
ヘッダ下端と本文上端の縦間隔=10truept,
ヘッダと本文を仕切る線の太さ=0truept,
本文下端とフッタ下端の縦間隔=20truept,
本文とフッタを仕切る線の太さ=0truept,
傍注領域の幅=0truept,
本文端と傍注領域との間隔=0truept,
傍注同士の縦間隔=\baselineskip,
奇数ページの傍注位置=右,
偶数ページの傍注位置=左,
]
\makeatletter
\pgfdeclareshape{datastore}{
  \inheritsavedanchors[from=rectangle]
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{north west}
  \backgroundpath{
    %  store lower right in xa/ya and upper right in xb/yb
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
 }
}
\makeatother

\tikzset{
	MyPersp/.style={scale=1.5,x={(-0.8cm,-0.4cm)},y={(0.8cm,-0.4cm)},z={(0cm,1cm)}},
%  MyPersp/.style={scale=1.5,x={(0cm,0cm)},y={(1cm,0cm)},
%    z={(0cm,1cm)}}, % uncomment the two lines to get a lateral view
	MyPoints/.style={fill=white,draw=black,thick}
		}




\begin{document}

%\begin{tikzpicture}[MyPersp,font=\large]
%\draw (0,0,0)--(1,0,0);
%\draw (0,0,0)--(0,1,0);
%\draw (0,0,0)--(0,0,1);
%\end{tikzpicture}

\begin{tikzpicture}[MyPersp,font=\large]
	% the base circle is the unit circle in plane Oxy
	\def\h{2}% Heigth of the ellipse center (on the axis of the cylinder)
	\def\a{30}% angle of the section plane with the horizontal
	\def\aa{20}% angle that defines position of generatrix PA--PB
	\pgfmathparse{\h/tan(\a)}
  \let\b\pgfmathresult
	\pgfmathparse{sqrt(1/cos(\a)/cos(\a)-1)}
  \let\c\pgfmathresult %Center Focus distance of the section ellipse.
	\pgfmathparse{\c/sin(\a)}
  \let\p\pgfmathresult % Position of Dandelin spheres centers
                       % on the Oz axis (\h +/- \p)
	\coordinate (A) at (2,\b,0);
	\coordinate (B) at (-2,\b,0);
	\coordinate (C) at (-2,-1.5,{(1.5+\b)*tan(\a)});
	\coordinate (D) at (2,-1.5,{(1.5+\b)*tan(\a)});
	\coordinate (E) at (2,-1.5,0);
	\coordinate (F) at (-2,-1.5,0);
	\coordinate (CLS) at (0,0,{\h-\p});
	\coordinate (CUS) at (0,0,{\h+\p});
	\coordinate (FA) at (0,{\c*cos(\a)},{-\c*sin(\a)+\h});% Focii
	\coordinate (FB) at (0,{-\c*cos(\a)},{\c*sin(\a)+\h});
	\coordinate (SA) at (0,1,{-tan(\a)+\h}); % Vertices of the
                                           % great axes of the ellipse
	\coordinate (SB) at (0,-1,{tan(\a)+\h});
	\coordinate (PA) at ({sin(\aa},{cos(\aa)},{\h+\p});
	\coordinate (PB) at ({sin(\aa},{cos(\aa)},{\h-\p});
	\coordinate (P) at ({sin(\aa)},{cos(\aa)},{-tan(\a)*cos(\aa)+\h});
     % Point on the ellipse on generatrix PA--PB

	\fill[blue!15,draw=blue,opacity=0.5] (A)--(B)--(C)--(D)--cycle;
	\fill[blue!15,draw=blue,opacity=0.5] (D)--(E)--(F)--(C)--cycle;
	\fill[blue!15,draw=blue,opacity=0.5] (A)--(D)--(E)--cycle;
	\fill[blue!15,draw=blue,opacity=0.5] (B)--(C)--(F)--cycle;
	\fill[blue!15,draw=blue,opacity=0.5] (A)--(B)--(F)--(E)--cycle;	
%	\draw[blue,very thick] (SA)--(SB);

\fill[ball color=white!10] (0,0,0) circle (1);

	\foreach \t in {2,4,...,360}% generatrices
		\draw[magenta,densely dotted] ({cos(\t)},{sin(\t)},0)
      --({cos(\t)},{sin(\t)},{2.0*\h});
	\draw[magenta,very thick] (1,0,0) % lower circle
		\foreach \t in {10,20,...,360}
			{--({cos(\t)},{sin(\t)},0)}--cycle;
	\draw[magenta,very thick] (1,0,{2*\h}) % upper circle
		\foreach \t in {10,20,...,360}
			{--({cos(\t)},{sin(\t)},{2*\h})}--cycle;
	\fill[blue!30,draw=blue,very thick,opacity=0.5]
     (0,1,{\h-tan(\a)}) % elliptical section
		\foreach \t in {10,20,...,360}
			{--({sin(\t)},{cos(\t)},{-tan(\a)*cos(\t)+\h})}--cycle;

	\foreach \i in {-1,1}{%Spheres!
		\foreach \t in {10,20,...,180}% meridians
			{\draw[gray] ({cos(\t)},{sin(\t)},\h+\i*\p)
				\foreach \rho in {20,40,...,360}
					{--({cos(\t)*cos(\rho)},{sin(\t)*cos(\rho)},{sin(\rho)+\h+\i*\p})}--cycle;
			}
		\foreach \t in {-75,-60,...,75}% parallels
			{\draw[gray] ({cos(\t)},0,{sin(\t)+\h+\i*\p})
				\foreach \rho in {20,40,...,360}
					{--({cos(\t)*cos(\rho)},{cos(\t)*sin(\rho)},
          {sin(\t)+\h+\i*\p})}--cycle;
			}
					\draw[orange,very thick] (1,0,{\h+\i*\p})% Equators
		\foreach \t in {5,10,...,360}
			{--({cos(\t)},{sin(\t)},{\h+\i*\p})}--cycle;
		}
%	\draw[red,very thick] (PA)--(PB);
%	\draw[red,very thick] (FA)--(P)--(FB);
%	\fill[MyPoints] (CLS) circle (1pt);% center of lower sphere
%	\fill[MyPoints] (CUS) circle (1pt);% center of upper sphere
%	\fill[MyPoints] (FA) circle (1pt)node[right]{$F_1$};
%	\fill[MyPoints] (FB) circle (1pt)node[left]{$F_2$};
%	\fill[MyPoints] (SA) circle (1pt);
%	\fill[MyPoints] (SB) circle (1pt);
%	\fill[MyPoints] (P) circle (1pt)node[below left]{$P$};
%	\fill[MyPoints] (PA) circle (1pt)node[below right]{$P_1$};
%	\fill[MyPoints] (PB) circle (1pt)node[above right]{$P_2$};




\end{tikzpicture}


\end{document}