开始使用 TikZ 绘制基本的 3D 对象

开始使用 TikZ 绘制基本的 3D 对象

是否可以使用 Ti 绘制此图Z(或者可能是与 postscript、metapost、SVG 等相关的类似包)? 在此处输入图片描述 抱歉,这次我没什么可以提供的。我通常喜欢在提问时提供一堆代码(或一些有用或有价值的东西),但我不知道从哪里开始,或者是否有可能,或者 TiZ 甚至是针对这种风格的插图而设计的。

以下是我在 Wikimedia Commons 上看到的一些类似/相关的矢量图,我认为它们很棒;按复杂程度逐渐增加的顺序显示。我不确定是用什么软件画的,但如果我能掌握诀窍,我希望最终能制作出这种质量的插图:

在此处输入图片描述

在此处输入图片描述 在此处输入图片描述

答案1

首次尝试草图

在此处输入图片描述

代码如下:

def I [1,0,0]
def myCab {
special |
\definecolor{fcab}{HTML}{b8c5de}
\definecolor{scab}{HTML}{d8d9eb}
\definecolor{tcab}{HTML}{ffffb7}
\definecolor{focab}{HTML}{ffdbab}
| [lay=under]
sweep [draw=fcab!80!black,fill=fcab!80!black]{ 30<>, rotate(360/30, [I]) }
line[line width=0pt,draw=fcab,fill=fcab](-1,-0.1)(1,-0.1)

sweep [draw=scab!80!black,fill=scab!80!black]{ 40<>, rotate(360/40, [I]) }
line[line width=0pt,draw=scab,fill=scab](1,-1)(3,-1)

sweep [draw=tcab!80!black,fill=tcab!80!black]{ 50<>, rotate(360/50, [I]) }
line[line width=0pt,draw=tcab,fill=tcab](3,-2)(5,-2)

sweep [draw=focab!80!black,fill=focab!80!black]{ 60<>, rotate(360/60, [I]) }
line[line width=0pt,draw=focab,fill=focab](5,-3)(7,-3)
}

put {
rotate (35,(0,0,0),[0,1,0])
then
rotate (30,(0,0,0),[1,0,0])
}
{myCab}
global { language tikz }

对应的TikZ图片是:

\documentclass[border=1]{standalone}
\usepackage{tikz}
\begin{document}
% Sketch output, version 0.3 (build 7, Fri Feb 24 21:22:17 2012)
% Output language: PGF/TikZ,LaTeX
\begin{tikzpicture}[line join=round]

\definecolor{fcab}{HTML}{b8c5de}
\definecolor{scab}{HTML}{d8d9eb}
\definecolor{tcab}{HTML}{ffffb7}
\definecolor{focab}{HTML}{ffdbab}
\filldraw[draw=focab!80!black,fill=focab!80!black](4.096,-1.164)--(4.276,-1.278)--(4.454,-1.363)--(4.627,-1.417)--(4.796,-1.439)--(4.956,-1.43)--(5.107,-1.39)--(5.247,-1.319)--(5.375,-1.218)--(5.488,-1.087)--(5.586,-.929)--(5.668,-.745)--(5.732,-.537)--(5.779,-.308)--(5.807,-.06)--(5.816,.205)--(5.807,.484)--(5.779,.772)--(5.732,1.068)--(5.668,1.368)--(5.586,1.669)--(5.488,1.967)--(5.375,2.259)--(5.247,2.543)--(5.107,2.814)--(4.956,3.07)--(4.796,3.308)--(4.627,3.525)--(4.454,3.72)--(4.276,3.889)--(4.096,4.032)--(3.916,4.146)--(3.738,4.231)--(3.564,4.285)--(3.396,4.307)--(3.235,4.298)--(3.084,4.258)--(2.944,4.187)--(2.817,4.086)--(2.704,3.955)--(2.606,3.797)--(2.524,3.613)--(2.459,3.405)--(2.413,3.176)--(2.384,2.928)--(2.375,2.663)--(2.384,2.384)--(2.413,2.096)--(2.459,1.8)--(2.524,1.5)--(2.606,1.199)--(2.704,.901)--(2.817,.609)--(2.944,.325)--(3.084,.054)--(3.235,-.202)--(3.396,-.44)--(3.564,-.657)--(3.738,-.852)--(3.916,-1.021)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](3.235,4.298)--(4.874,4.872)--(4.723,4.832)--(3.084,4.258)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.107,-1.39)--(6.745,-.817)--(6.885,-.745)--(5.247,-1.319)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](3.396,4.307)--(5.034,4.881)--(4.874,4.872)--(3.235,4.298)--cycle;
\filldraw[draw=tcab!80!black,fill=tcab!80!black](2.457,-.872)--(2.601,-.961)--(2.743,-1.021)--(2.88,-1.052)--(3.01,-1.052)--(3.132,-1.022)--(3.243,-.963)--(3.341,-.875)--(3.426,-.759)--(3.495,-.618)--(3.548,-.454)--(3.584,-.269)--(3.602,-.066)--(3.602,.152)--(3.584,.38)--(3.548,.617)--(3.495,.857)--(3.426,1.097)--(3.341,1.333)--(3.243,1.562)--(3.132,1.78)--(3.01,1.984)--(2.88,2.169)--(2.743,2.334)--(2.601,2.476)--(2.457,2.592)--(2.314,2.681)--(2.172,2.742)--(2.035,2.772)--(1.905,2.773)--(1.783,2.743)--(1.672,2.684)--(1.574,2.596)--(1.489,2.48)--(1.419,2.339)--(1.366,2.175)--(1.331,1.99)--(1.313,1.787)--(1.313,1.569)--(1.331,1.34)--(1.366,1.104)--(1.419,.864)--(1.489,.624)--(1.574,.387)--(1.672,.159)--(1.783,-.059)--(1.905,-.263)--(2.035,-.449)--(2.172,-.614)--(2.314,-.755)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.247,-1.319)--(6.885,-.745)--(7.013,-.644)--(5.375,-1.218)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](3.564,4.285)--(5.202,4.858)--(5.034,4.881)--(3.396,4.307)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.375,-1.218)--(7.013,-.644)--(7.126,-.514)--(5.488,-1.087)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](3.738,4.231)--(5.376,4.804)--(5.202,4.858)--(3.564,4.285)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.488,-1.087)--(7.126,-.514)--(7.224,-.356)--(5.586,-.929)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](1.905,2.773)--(3.543,3.346)--(3.421,3.317)--(1.783,2.743)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.132,-1.022)--(4.77,-.449)--(4.881,-.389)--(3.243,-.963)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](3.916,4.146)--(5.554,4.72)--(5.376,4.804)--(3.738,4.231)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.586,-.929)--(7.224,-.356)--(7.306,-.172)--(5.668,-.745)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.035,2.772)--(3.673,3.346)--(3.543,3.346)--(1.905,2.773)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.243,-.963)--(4.881,-.389)--(4.98,-.301)--(3.341,-.875)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.096,4.032)--(5.734,4.606)--(5.554,4.72)--(3.916,4.146)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.668,-.745)--(7.306,-.172)--(7.371,.036)--(5.732,-.537)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.172,2.742)--(3.81,3.315)--(3.673,3.346)--(2.035,2.772)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.341,-.875)--(4.98,-.301)--(5.064,-.186)--(3.426,-.759)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.276,3.889)--(5.914,4.463)--(5.734,4.606)--(4.096,4.032)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.732,-.537)--(7.371,.036)--(7.417,.265)--(5.779,-.308)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.314,2.681)--(3.952,3.255)--(3.81,3.315)--(2.172,2.742)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.426,-.759)--(5.064,-.186)--(5.134,-.045)--(3.495,-.618)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.454,3.72)--(6.092,4.293)--(5.914,4.463)--(4.276,3.889)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.779,-.308)--(7.417,.265)--(7.445,.514)--(5.807,-.06)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.457,2.592)--(4.096,3.166)--(3.952,3.255)--(2.314,2.681)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.495,-.618)--(5.134,-.045)--(5.187,.12)--(3.548,-.454)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.627,3.525)--(6.266,4.099)--(6.092,4.293)--(4.454,3.72)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.807,-.06)--(7.445,.514)--(7.455,.779)--(5.816,.205)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.559,1.244)--(2.197,1.818)--(2.12,1.802)--(.482,1.228)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.601,2.476)--(4.24,3.05)--(4.096,3.166)--(2.457,2.592)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.156,-.655)--(2.795,-.081)--(2.863,-.042)--(1.225,-.615)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.548,-.454)--(5.187,.12)--(5.223,.305)--(3.584,-.269)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.796,3.308)--(6.434,3.881)--(6.266,4.099)--(4.627,3.525)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.642,1.237)--(2.28,1.811)--(2.197,1.818)--(.559,1.244)--cycle;
\filldraw[draw=scab!80!black,fill=scab!80!black](.819,-.579)--(.909,-.633)--(.996,-.663)--(1.08,-.671)--(1.156,-.655)--(1.225,-.615)--(1.283,-.554)--(1.33,-.471)--(1.365,-.37)--(1.386,-.253)--(1.393,-.123)--(1.386,.018)--(1.365,.165)--(1.33,.315)--(1.283,.464)--(1.225,.61)--(1.156,.747)--(1.08,.872)--(.996,.984)--(.909,1.078)--(.819,1.153)--(.729,1.206)--(.642,1.237)--(.559,1.244)--(.482,1.228)--(.414,1.189)--(.355,1.127)--(.308,1.045)--(.274,.944)--(.253,.827)--(.246,.696)--(.253,.556)--(.274,.409)--(.308,.259)--(.355,.109)--(.414,-.036)--(.482,-.173)--(.559,-.299)--(.642,-.41)--(.729,-.505)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.816,.205)--(7.455,.779)--(7.445,1.057)--(5.807,.484)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.225,-.615)--(2.863,-.042)--(2.921,.02)--(1.283,-.554)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.743,2.334)--(4.381,2.908)--(4.24,3.05)--(2.601,2.476)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.584,-.269)--(5.223,.305)--(5.241,.508)--(3.602,-.066)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](4.956,3.07)--(6.594,3.643)--(6.434,3.881)--(4.796,3.308)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.729,1.206)--(2.368,1.78)--(2.28,1.811)--(.642,1.237)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.283,-.554)--(2.921,.02)--(2.969,.102)--(1.33,-.471)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.807,.484)--(7.445,1.057)--(7.417,1.346)--(5.779,.772)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](2.88,2.169)--(4.518,2.743)--(4.381,2.908)--(2.743,2.334)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.602,-.066)--(5.241,.508)--(5.241,.725)--(3.602,.152)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.107,2.814)--(6.745,3.387)--(6.594,3.643)--(4.956,3.07)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.819,1.153)--(2.457,1.726)--(2.368,1.78)--(.729,1.206)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.33,-.471)--(2.969,.102)--(3.003,.203)--(1.365,-.37)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.779,.772)--(7.417,1.346)--(7.371,1.642)--(5.732,1.068)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.01,1.984)--(4.648,2.557)--(4.518,2.743)--(2.88,2.169)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.247,2.543)--(6.885,3.116)--(6.745,3.387)--(5.107,2.814)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.602,.152)--(5.241,.725)--(5.223,.954)--(3.584,.38)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.909,1.078)--(2.547,1.652)--(2.457,1.726)--(.819,1.153)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.732,1.068)--(7.371,1.642)--(7.306,1.942)--(5.668,1.368)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.365,-.37)--(3.003,.203)--(3.024,.32)--(1.386,-.253)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.375,2.259)--(7.013,2.833)--(6.885,3.116)--(5.247,2.543)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.132,1.78)--(4.77,2.354)--(4.648,2.557)--(3.01,1.984)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.668,1.368)--(7.306,1.942)--(7.224,2.242)--(5.586,1.669)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.584,.38)--(5.223,.954)--(5.187,1.19)--(3.548,.617)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.488,1.967)--(7.126,2.541)--(7.013,2.833)--(5.375,2.259)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](.996,.984)--(2.635,1.557)--(2.547,1.652)--(.909,1.078)--cycle;
\filldraw[line width=0pt,draw=focab,fill=focab](5.586,1.669)--(7.224,2.242)--(7.126,2.541)--(5.488,1.967)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.386,-.253)--(3.024,.32)--(3.031,.451)--(1.393,-.123)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.243,1.562)--(4.881,2.136)--(4.77,2.354)--(3.132,1.78)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.548,.617)--(5.187,1.19)--(5.134,1.43)--(3.495,.857)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.08,.872)--(2.718,1.446)--(2.635,1.557)--(.996,.984)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.341,1.333)--(4.98,1.907)--(4.881,2.136)--(3.243,1.562)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.393,-.123)--(3.031,.451)--(3.024,.591)--(1.386,.018)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.495,.857)--(5.134,1.43)--(5.064,1.67)--(3.426,1.097)--cycle;
\filldraw[line width=0pt,draw=tcab,fill=tcab](3.426,1.097)--(5.064,1.67)--(4.98,1.907)--(3.341,1.333)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.156,.747)--(2.795,1.32)--(2.718,1.446)--(1.08,.872)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.386,.018)--(3.024,.591)--(3.003,.738)--(1.365,.165)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.225,.61)--(2.863,1.183)--(2.795,1.32)--(1.156,.747)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.365,.165)--(3.003,.738)--(2.969,.889)--(1.33,.315)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.283,.464)--(2.921,1.038)--(2.863,1.183)--(1.225,.61)--cycle;
\filldraw[line width=0pt,draw=scab,fill=scab](1.33,.315)--(2.969,.889)--(2.921,1.038)--(1.283,.464)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.842,-.191)--(.796,.383)--(.785,.381)--(-.853,-.193)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.785,-.381)--(.853,.193)--(.862,.198)--(-.777,-.375)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.831,-.194)--(.807,.38)--(.796,.383)--(-.842,-.191)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.777,-.375)--(.862,.198)--(.869,.208)--(-.769,-.366)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.819,-.2)--(.819,.373)--(.807,.38)--(-.831,-.194)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.769,-.366)--(.869,.208)--(.874,.221)--(-.765,-.353)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.807,-.211)--(.831,.363)--(.819,.373)--(-.819,-.2)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.765,-.353)--(.874,.221)--(.876,.237)--(-.762,-.337)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.796,-.224)--(.842,.349)--(.831,.363)--(-.807,-.211)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.762,-.337)--(.876,.237)--(.876,.255)--(-.762,-.318)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.785,-.241)--(.853,.333)--(.842,.349)--(-.796,-.224)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.762,-.318)--(.876,.255)--(.874,.275)--(-.765,-.299)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.777,-.259)--(.862,.314)--(.853,.333)--(-.785,-.241)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.765,-.299)--(.874,.275)--(.869,.295)--(-.769,-.279)--cycle;
\filldraw[line width=0pt,draw=fcab,fill=fcab](-.769,-.279)--(.869,.295)--(.862,.314)--(-.777,-.259)--cycle;
\filldraw[draw=fcab!80!black,fill=fcab!80!black](-.819,-.373)--(-.807,-.38)--(-.796,-.383)--(-.785,-.381)--(-.777,-.375)--(-.769,-.366)--(-.765,-.353)--(-.762,-.337)--(-.762,-.318)--(-.765,-.299)--(-.769,-.279)--(-.777,-.259)--(-.785,-.241)--(-.796,-.224)--(-.807,-.211)--(-.819,-.2)--(-.831,-.194)--(-.842,-.191)--(-.853,-.193)--(-.862,-.198)--(-.869,-.208)--(-.874,-.221)--(-.876,-.237)--(-.876,-.255)--(-.874,-.275)--(-.869,-.295)--(-.862,-.314)--(-.853,-.333)--(-.842,-.349)--(-.831,-.363)--cycle;
\end{tikzpicture}% End sketch output
\end{document}

相关内容