
나는 , 및 유사한 객체가 그림의 나머지 부분과 함께 회전할 tikz-3dplot
것으로 예상하고 사용합니다. 그러나 마치 2D인 것처럼 그려집니다. 회전된 좌표에 a를 강제로 그리려면 어떻게 해야 합니까 ?rectangle
grid
rectangle
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{patterns, arrows, matrix, positioning, decorations.markings, arrows.meta, decorations.pathreplacing}
\usepackage{tikz-3dplot}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\tdplotsetmaincoords{70}{110}
\def\mycolor{blue}
\begin{tikzpicture}[scale=1, tdplot_main_coords, axis/.style={->,\mycolor,thick}]
\def\latnum{8}
\def\lonnum{8}
\draw[axis] (0,0,0) -- (\latnum+1,0,0) node[anchor=north east]{\huge $lat$};
\draw[axis] (0,0,0) -- (0,\lonnum+1,0) node[anchor=north west]{\huge $lon$};
\fill [orange] (\latnum-2,\lonnum-2,0) rectangle (2,2,0);
\end{tikzpicture}
\end{document}
답변1
이것은 매우 흥미로운 질문입니다.
다음 줄은 동일할 것으로 예상됩니다. 그러나 그들은 그렇지 않습니다.
\draw[red](0,0)rectangle(1,1);
\draw[blue](0,0)--(1,0)--(1,1)--(0,1)--cycle;
그만큼rectangle
는 Ti에 의해 처리됩니다.케이다음 줄로 Z( tikz.code.tex
라인 3140-3148 )
\pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% \tikz@path@lineto{\pgfqpoint{\pgf@xa}{\tikz@lasty}}% \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}% \tikz@path@lineto{\pgfqpoint{\tikz@lastx}{\pgf@ya}}% \pgfpathclose% \pgfpathmoveto{\pgfqpoint{\tikz@lastx}{\tikz@lasty}}%
이 수준에서는 PGF가 그래픽의 3D 구조를 인식하지 못하므로 사각형이 2D 방식으로 캔버스에 그려집니다.
그리고 여기에 정말 아이러니한 점이 있습니다. 만약 당신이 \usetikzlibrary{3d}
그리고 글을 쓴 다면
\draw[canvas is xy plane at z=0](0,0)rectangle(1,1)circle(1);
\draw[canvas is yz plane at x=0](0,0)rectangle(1,1)circle(1);
\draw[canvas is zx plane at y=0](0,0)rectangle(1,1)circle(1);
그러면 세 개의 원이 올바르게 그려지고 세 개의 직사각형 중 두 개가 올바르게 그려집니다. 잘못된 것은 xy 평면에 있는 것입니다.
이 문제는 다음에서 수정되었습니다.3D 직사각형 그리기.