Forgot password
 Register account
View 1588|Reply 4

阴影填充一例,fill 的特性 + clip

[Copy link]

678

Threads

110K

Posts

213

Reputation

Show all posts

kuing posted 2018-6-23 14:03 |Read mode
问题来自:bbs.ctex.org/forum.php?mod=viewthread&tid=155195
要画这样的图:
QQ截图20180623134918.jpg

解:为了使阴影与图中完全一样,需加载 \usetikzlibrary{patterns},然后:
  1. \begin{tikzpicture}
  2. \begin{scope}
  3. \clip (0,0) arc (-90:0:2) arc (90:180:2);
  4. \fill[pattern=horizontal lines]
  5. (0,0) arc (-90:0:2) --(1,1) arc (90:0:1);
  6. \fill[pattern=vertical lines]
  7. (0,0) arc (180:90:2) --(1,1) arc (0:90:1);
  8. \end{scope}
  9. \draw[->](-0.5,0)--(4.5,0)node[below]{$x$};
  10. \draw[->](0,-0.5)--(0,4.5)node[left]{$y$};
  11. \draw (0,0) arc (-90:90:2) (0,0) arc (-90:90:1)
  12. (0,0) arc (180:0:2) (0,0) arc (180:0:1) (0,0)--(2,2);
  13. \end{tikzpicture}
Copy the Code
效果:


解释:由 fill 的特性,\fill[pattern=horizontal lines](0,0) arc (-90:0:2) --(1,1) arc (90:0:1); 这一句所填充的是这样的区域:

然后由于前面有个 clip,就只剩上面那块了,另一边同理。

767

Threads

4687

Posts

27

Reputation

Show all posts

isee posted 2018-6-23 17:15
回复 1# kuing

这种阴影在常见的几种数学作图软件中都很麻烦
有个类似的链接

678

Threads

110K

Posts

213

Reputation

Show all posts

original poster kuing posted 2018-6-23 17:23
回复 2# isee

链接那个太简单,clip 一下搞定啊
不用 clip 也行,直接填绿圆,再用白的大圆盖住就行了,当然这不及 clip 那么好,因为背景不一定是白的

767

Threads

4687

Posts

27

Reputation

Show all posts

isee posted 2018-6-27 23:43
回复 3# kuing


正是因为比你的简单才链接的,嘿嘿,好入门。

3175

Threads

7938

Posts

48

Reputation

Show all posts

hbghlyj posted 2023-7-30 14:27
Last edited by hbghlyj 2023-7-30 14:40Asymptote使用buildcycle

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-1 09:04 GMT+8

Powered by Discuz!

Processed in 0.015480 seconds, 26 queries