Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.42 KB | None | 0 0
  1. documentclass{article}
  2.  
  3. usepackage{tikz}
  4.  
  5. begin{document}
  6.  
  7. begin{tikzpicture}[scale=1.25]%,cap=round,>=latex]
  8.  
  9. coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
  10. coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
  11. coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
  12. draw (A) -- node[above] {$a$} (B) -- node[right] {$c$} (C) -- node[below] {$b$} (A);
  13.  
  14. draw (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
  15.  
  16. end{tikzpicture}
  17.  
  18. end{document}
  19.  
  20. newcommand{pythagwidth}{3cm}
  21. newcommand{pythagheight}{2cm}
  22.  
  23. coordinate [label={below right:$A$}] (A) at (0, 0);
  24. coordinate [label={above right:$B$}] (B) at (0, pythagheight);
  25. coordinate [label={below left:$C$}] (C) at (-pythagwidth, 0);
  26.  
  27. draw [dashed] (A) -- node [below] {$b$} ++ (-pythagwidth, 0)
  28. -- node [right] {$b$} ++ (0, -pythagwidth)
  29. -- node [above] {$b$} ++ (pythagwidth, 0)
  30. -- node [left] {$b$} ++ (0, pythagwidth);
  31.  
  32. draw [dashed] (A) -- node [right] {$c$} ++ (0, pythagheight)
  33. -- node [below] {$c$} ++ (pythagheight, 0)
  34. -- node [left] {$c$} ++ (0, -pythagheight)
  35. -- node [above] {$c$} ++ (-pythagheight, 0);
  36.  
  37. coordinate (D1) at (-pythagheight, pythagheight + pythagwidth);
  38. coordinate (D2) at (-pythagheight - pythagwidth, pythagwidth);
  39.  
  40. draw [dashed] (C) -- node [above left] {$a$} (B)
  41. -- node [below left] {$a$} (D1)
  42. -- node [below right] {$a$} (D2)
  43. -- node [above right] {$a$} (C);
  44.  
  45. documentclass{article}
  46.  
  47. usepackage{tikz}
  48.  
  49. begin{document}
  50.  
  51. newcommand{pythagwidth}{3cm}
  52. newcommand{pythagheight}{2cm}
  53.  
  54. begin{tikzpicture}
  55.  
  56. coordinate [label={below right:$A$}] (A) at (0, 0);
  57. coordinate [label={above right:$B$}] (B) at (0, pythagheight);
  58. coordinate [label={below left:$C$}] (C) at (-pythagwidth, 0);
  59.  
  60. coordinate (D1) at (-pythagheight, pythagheight + pythagwidth);
  61. coordinate (D2) at (-pythagheight - pythagwidth, pythagwidth);
  62.  
  63. draw [very thick] (A) -- (C) -- (B) -- (A);
  64.  
  65. newcommand{ranglesize}{0.3cm}
  66. draw (A) -- ++ (0, ranglesize) -- ++ (-ranglesize, 0) -- ++ (0, -ranglesize);
  67.  
  68. draw [dashed] (A) -- node [below] {$b$} ++ (-pythagwidth, 0)
  69. -- node [right] {$b$} ++ (0, -pythagwidth)
  70. -- node [above] {$b$} ++ (pythagwidth, 0)
  71. -- node [left] {$b$} ++ (0, pythagwidth);
  72.  
  73. draw [dashed] (A) -- node [right] {$c$} ++ (0, pythagheight)
  74. -- node [below] {$c$} ++ (pythagheight, 0)
  75. -- node [left] {$c$} ++ (0, -pythagheight)
  76. -- node [above] {$c$} ++ (-pythagheight, 0);
  77.  
  78. draw [dashed] (C) -- node [above left] {$a$} (B)
  79. -- node [below left] {$a$} (D1)
  80. -- node [below right] {$a$} (D2)
  81. -- node [above right] {$a$} (C);
  82.  
  83. end{tikzpicture}
  84.  
  85. end{document}
  86.  
  87. ($ (<name1>) ! {sin(90)} ! 90:(<name2>) $)
  88.  
  89. documentclass{article}
  90. usepackage{tikz}
  91. usetikzlibrary{calc}
  92.  
  93. begin{document}
  94.  
  95. begin{tikzpicture}[scale=1.25]
  96. coordinate [label=left:$A$] (A) at (-1.5cm,-1.cm);
  97. coordinate [label=below right:$C$] (C) at (1.5cm,-1.0cm);
  98. coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
  99.  
  100. draw
  101. (A) --
  102. node[above] {$c$} (B) --
  103. node[right] {$b$} (C) --
  104. node[below] {$a$}
  105. (A);
  106. draw
  107. (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
  108.  
  109. coordinate (aux1) at
  110. ($ (A) ! {sin(90)} ! 90:(B) $);
  111. coordinate (aux2) at
  112. ($ (aux1) ! {sin(90)} ! 90:(A) $);
  113.  
  114. coordinate (aux3) at
  115. ($ (A) ! {sin(90)} ! -90:(C) $);
  116. coordinate (aux4) at
  117. ($ (aux3) ! {sin(90)} ! -90:(A) $);
  118.  
  119. coordinate (aux5) at
  120. ($ (C) ! {sin(90)} ! -90:(B) $);
  121. coordinate (aux6) at
  122. ($ (aux5) ! {sin(90)} ! -90:(C) $);
  123.  
  124. draw[ultra thick,green,text=black]
  125. (A) --
  126. (aux1) node[midway,auto,swap] {$c$} --
  127. (aux2) node[midway,auto,swap] {$c$} --
  128. (B) node[midway,auto,swap] {$c$};
  129. draw[ultra thick,green,text=black]
  130. (A) --
  131. (aux3) node[midway,auto] {$a$} --
  132. (aux4) node[midway,auto] {$a$} --
  133. (C) node[midway,auto] {$a$};
  134. draw[ultra thick,green,text=black]
  135. (C) --
  136. (aux5) node[midway,auto] {$b$} --
  137. (aux6) node[midway,auto] {$b$} --
  138. (B) node[midway,auto] {$b$};
  139. end{tikzpicture}
  140.  
  141. end{document}
  142.  
  143. PythTr[<options>]{<name1>}{<name2>}{<name3>}{<coord1>}{<coord2>}{<coord3>}
  144.  
  145. begin{tikzpicture}
  146. PythTr{A}{B}{C}{(-1.5cm,-1.cm)}{(1.5cm,-1.0cm)}{(1.5cm,1.0cm)}
  147. end{tikzpicture}parbigskip
  148.  
  149. begin{tikzpicture}
  150. PythTr[Maroon,dashed]{L}{M}{N}{(2,-2)}{(4,2)}{(0,2)}
  151. end{tikzpicture}
  152.  
  153. documentclass{article}
  154. usepackage[dvipsnames]{xcolor}
  155. usepackage{tikz}
  156. usetikzlibrary{calc}
  157.  
  158. newcommandPythTr[7][ultra thick,green,text=black]{%
  159. coordinate [label=left:$#2$] (#2) at #5;
  160. coordinate [label=below right:$#4$] (#4) at #6;
  161. coordinate [label=above:$#3$] (#3) at #7;
  162.  
  163. draw
  164. (#2) --
  165. node[auto] {$MakeLowercase{#4}$} (#3) --
  166. node[auto] {$MakeLowercase{#3}$} (#4) --
  167. node[auto] {$MakeLowercase{#2}$}
  168. (#2);
  169.  
  170. coordinate (aux1) at
  171. ($ (#2) ! {sin(90)} ! 90:(#3) $);
  172. coordinate (aux2) at
  173. ($ (aux1) ! {sin(90)} ! 90:(#2) $);
  174.  
  175. coordinate (aux3) at
  176. ($ (#2) ! {sin(90)} ! -90:(#4) $);
  177. coordinate (aux4) at
  178. ($ (aux3) ! {sin(90)} ! -90:(#2) $);
  179.  
  180. coordinate (aux5) at
  181. ($ (#4) ! {sin(90)} ! -90:(#3) $);
  182. coordinate (aux6) at
  183. ($ (aux5) ! {sin(90)} ! -90:(#4) $);
  184.  
  185. begin{scope}[#1]
  186. draw
  187. (#2) --
  188. (aux1) node[midway,auto,swap] {$MakeLowercase{#4}$} --
  189. (aux2) node[midway,auto,swap] {$MakeLowercase{#4}$} --
  190. (#3) node[midway,auto,swap] {$MakeLowercase{#4}$};
  191. draw
  192. (#2) --
  193. (aux3) node[midway,auto] {$MakeLowercase{#2}$} --
  194. (aux4) node[midway,auto] {$MakeLowercase{#2}$} --
  195. (#4) node[midway,auto] {$MakeLowercase{#2}$};
  196. draw
  197. (#4) --
  198. (aux5) node[midway,auto] {$MakeLowercase{#3}$} --
  199. (aux6) node[midway,auto] {$MakeLowercase{#3}$} --
  200. (#3) node[midway,auto] {$MakeLowercase{#3}$};
  201. end{scope}
  202. }
  203.  
  204. begin{document}
  205.  
  206. begin{tikzpicture}
  207. PythTr{A}{B}{C}{(-1.5cm,-1.cm)}{(1.5cm,-1.0cm)}{(1.5cm,1.0cm)}
  208. end{tikzpicture}parbigskip
  209.  
  210. begin{tikzpicture}
  211. PythTr[Maroon,dashed]{L}{M}{N}{(2,-2)}{(4,2)}{(0,2)}
  212. end{tikzpicture}
  213.  
  214. end{document}
  215.  
  216. documentclass{article}
  217. usepackage[dvipsnames]{xcolor}
  218. usepackage{tikz}
  219. usetikzlibrary{calc}
  220.  
  221. newcommandPythTri[7][ultra thick,green,text=black]{%
  222. coordinate [label=left:$#2$] (#2) at #5;
  223. coordinate [label=below right:$#4$] (#4) at #6;
  224. coordinate (aux) at ($ #5 ! 1 ! 90:#6 $);
  225. coordinate [label=above:$#3$] (#3) at ($ #5 !#7!(aux) $);
  226.  
  227. draw
  228. (#2) --
  229. node[auto] {$MakeLowercase{#4}$} (#3) --
  230. node[auto] {$MakeLowercase{#3}$} (#4) --
  231. node[auto] {$MakeLowercase{#2}$}
  232. (#2);
  233.  
  234. coordinate (aux1) at
  235. ($ (#2) ! {sin(90)} ! 90:(#3) $);
  236. coordinate (aux2) at
  237. ($ (aux1) ! {sin(90)} ! 90:(#2) $);
  238.  
  239. coordinate (aux3) at
  240. ($ (#2) ! {sin(90)} ! -90:(#4) $);
  241. coordinate (aux4) at
  242. ($ (aux3) ! {sin(90)} ! -90:(#2) $);
  243.  
  244. coordinate (aux5) at
  245. ($ (#4) ! {sin(90)} ! -90:(#3) $);
  246. coordinate (aux6) at
  247. ($ (aux5) ! {sin(90)} ! -90:(#4) $);
  248.  
  249. begin{scope}[#1]
  250. draw
  251. (#2) --
  252. (aux1) node[midway,auto,swap] {$MakeLowercase{#4}$} --
  253. (aux2) node[midway,auto,swap] {$MakeLowercase{#4}$} --
  254. (#3) node[midway,auto,swap] {$MakeLowercase{#4}$};
  255. draw
  256. (#2) --
  257. (aux3) node[midway,auto] {$MakeLowercase{#2}$} --
  258. (aux4) node[midway,auto] {$MakeLowercase{#2}$} --
  259. (#4) node[midway,auto] {$MakeLowercase{#2}$};
  260. draw
  261. (#4) --
  262. (aux5) node[midway,auto] {$MakeLowercase{#3}$} --
  263. (aux6) node[midway,auto] {$MakeLowercase{#3}$} --
  264. (#3) node[midway,auto] {$MakeLowercase{#3}$};
  265. end{scope}
  266. }
  267.  
  268. begin{document}
  269.  
  270. begin{tikzpicture}[scale=0.75]
  271. PythTri{A}{B}{C}{(0,4)}{(2,0)}{3cm}
  272. end{tikzpicture}parbigskip
  273.  
  274. begin{tikzpicture}[scale=0.75]
  275. PythTri[Maroon,dashed]{L}{M}{N}{(0,0)}{(4,0)}{3cm}
  276. end{tikzpicture}parbigskip
  277.  
  278. end{document}
  279.  
  280. PythTri[<options>]{<name1>}{<name2>}{<name3>}{<coord1>}{<coord2>}{<length>}
  281.  
  282. documentclass{article}
  283. usepackage{tikz}
  284. usetikzlibrary{calc}
  285.  
  286. begin{document}
  287.  
  288. begin{tikzpicture}[scale=1.25]
  289. coordinate [label=left:$C$] (A) at (-1.5cm,-1.cm);
  290. coordinate [label=right:$A$] (C) at (1.5cm,-1.0cm);
  291. coordinate [label=above:$B$] (B) at (1.5cm,1.0cm);
  292.  
  293. draw
  294. (A) --
  295. node[above] {$a$} (B) --
  296. node[right] {$c$} (C) --
  297. node[below] {$b$}
  298. (A);
  299. draw
  300. (1.25cm,-1.0cm) rectangle (1.5cm,-0.75cm);
  301. draw[ultra thick,green]
  302. let p1= ( $ (C)-(A) $ )
  303. in (A) --
  304. ++(-90:{veclen(x1,y1)}) --
  305. ++(0:{veclen(x1,y1)}) --
  306. ++(90:{veclen(x1,y1)});
  307. draw[ultra thick,green]
  308. let p1= ( $ (B)-(C) $ )
  309. in (B) --
  310. ++(0:{veclen(x1,y1)}) --
  311. ++(-90:{veclen(x1,y1)}) --
  312. ++(180:{veclen(x1,y1)});
  313. coordinate (aux1) at
  314. ($ (A) ! {sin(90)} ! 90:(B) $);
  315. coordinate (aux2) at
  316. ($ (aux1) ! {sin(90)} ! 90:(A) $);
  317. draw[ultra thick,green]
  318. (A) -- (aux1) -- (aux2) -- (B);
  319. end{tikzpicture}
  320.  
  321. end{document}
  322.  
  323. % Luamplib version
  324. documentclass[12pt]{article}
  325. usepackage{unicode-math}
  326. usepackage{luamplib}
  327. mplibsetformat{metafun}
  328. mplibtextextlabel{enable}
  329. everymplib{verbatimtex leavevmode etex;
  330. % Right angle mark
  331. % From "Tutorial in MetaPost" by André Heck
  332. mark_size := 2mm;
  333. vardef mark_right_angle(expr endofa, common, endofb) =
  334. save tn; tn := turningnumber(common--endofa--endofb--cycle);
  335. draw ((1, 0)--(1,1)--(0,1))
  336. zscaled (mark_size * unitvector((1+tn)*endofa+(1-tn)*endofb-2*common))
  337. shifted (common*u) ;
  338. enddef;
  339. % Drawing of a Pythagorean square based on vertex [AB]
  340. vardef pythagorean_square(expr A, B, legend)(text drawing_options) =
  341. save D, E, v, my_square, my_center;
  342. pair D, E, v, c, my_center; path my_square; clearxy;
  343. z = B - A;
  344. v = (-y, x);
  345. if t = 1:
  346. E = A - v;
  347. D = B - v;
  348. else:
  349. D = B + v;
  350. E = A + v;
  351. fi;
  352. my_square = B--D--E--A--cycle;
  353. my_center = center my_square;
  354. draw (B--D--E--A) scaled u drawing_options;
  355. freelabel(legend, u*0.5[A, E], u*(my_center reflectedabout (A, E)));
  356. freelabel(legend, u*0.5[E, D], u*(my_center reflectedabout (D, E)));
  357. freelabel(legend, u*0.5[D, B], u*(my_center reflectedabout (D, B)));
  358. freelabel(legend, u*0.5[A, B], u*(my_center reflectedabout (A, B)));
  359. enddef;
  360. % Drawing of the triangle and all its Pythagorean squares
  361. vardef pythagorean_config(expr A, B, C, c, a, b)(text drawing_options) =
  362. if angle(B-A) - angle(C-A) <> 0:
  363. t = turningnumber(A--B--C--cycle);
  364. pythagorean_square(A, B, c)(drawing_options);
  365. pythagorean_square(B, C, a)(drawing_options);
  366. pythagorean_square(C, A, b)(drawing_options);
  367. draw (A--B--C--cycle) scaled u;
  368. fi;
  369. enddef;
  370. beginfig(0);}
  371. everyendmplib{endfig;}
  372.  
  373. begin{document}
  374. begin{center}
  375. begin{mplibcode}
  376. u = 2.5cm;
  377. pair A, B, C; A = origin; B = (1, 0); C = (1, 1);
  378. label.llft("$A$", A*u); label.lrt("$B$", B*u); label.urt("$C$", C*u);
  379. pythagorean_config(A, B, C, "$c$", "$a$", "$b$")(dashed evenly);
  380. mark_right_angle(A, B, C);
  381. end{mplibcode}
  382. end{center}
  383.  
  384. bigskip
  385. begin{center}
  386. begin{mplibcode}
  387. u := 1.75cm;
  388. pair A, B, C; A = origin; B = (0.5, 1.5); C = A + 1.5*(B-A) rotated -90;
  389. freelabel("$A$", A*u, u*0.5[B,C]); label.top("$B$", B*u); label.lrt("$C$", C*u);
  390. pythagorean_config(A, B, C, "$c$", "$a$", "$b$")(withcolor red);
  391. mark_right_angle(B, A, C);
  392. end{mplibcode}
  393. end{center}
  394. end{document}
  395.  
  396. % GMP version
  397. documentclass[12pt]{article}
  398. usepackage[latex, shellescape]{gmp}
  399. gmpoptions{everymp={%
  400. input latexmp; setupLaTeXMP(options="12pt", mode=rerun, textextlabel=enable);
  401. % Right angle mark
  402. % From "Tutorial in MetaPost" by André Heck
  403. mark_size := 2mm;
  404. vardef mark_right_angle(expr endofa, common, endofb) =
  405. save tn; tn := turningnumber(common--endofa--endofb--cycle);
  406. draw ((1, 0)--(1,1)--(0,1))
  407. zscaled (mark_size * unitvector((1+tn)*endofa+(1-tn)*endofb-2*common))
  408. shifted (common*u) ;
  409. enddef;
  410. % Drawing of a Pythagorean square based on vertex [AB]
  411. vardef pythagorean_square(expr A, B, legend)(text drawing_options) =
  412. save D, E, v, my_square, my_center; pair D, E, v, c, my_center; path my_square; clearxy;
  413. z = B - A;
  414. v = (-y, x);
  415. if t = 1:
  416. E = A - v;
  417. D = B - v;
  418. else:
  419. D = B + v;
  420. E = A + v;
  421. fi;
  422. my_square = B--D--E--A--cycle;
  423. my_center = center my_square;
  424. draw (B--D--E--A) scaled u drawing_options;
  425. freelabel(legend, u*0.5[A, E], u*(my_center reflectedabout (A, E)));
  426. freelabel(legend, u*0.5[E, D], u*(my_center reflectedabout (D, E)));
  427. freelabel(legend, u*0.5[D, B], u*(my_center reflectedabout (D, B)));
  428. freelabel(legend, u*0.5[A, B], u*(my_center reflectedabout (A, B)));
  429. enddef;
  430. % Drawing of the triangle and all its Pythagorean squares
  431. vardef pythagorean_config(expr A, B, C, c, a, b)(text drawing_options) =
  432. if angle(B-A) - angle(C-A) <> 0:
  433. t := turningnumber(A--B--C--cycle);
  434. pythagorean_square(A, B, c)(drawing_options);
  435. pythagorean_square(B, C, a)(drawing_options);
  436. pythagorean_square(C, A, b)(drawing_options);
  437. draw (A--B--C--cycle) scaled u;
  438. fi;
  439. enddef;}}
  440.  
  441.  
  442. begin{document}
  443. begin{center}
  444. begin{mpost*}[mpmem = metafun]
  445. u := 2.5cm;
  446. pair A, B, C; A = origin; B = (1, 0); C = (1, 1);
  447. label.llft("$A$", A*u); label.lrt("$B$", B*u); label.urt("$C$", C*u);
  448. pythagorean_config(A, B, C, "$c$", "$a$", "$b$")(dashed evenly);
  449. mark_right_angle(A, B, C);
  450. end{mpost*}
  451. end{center}
  452.  
  453. bigskip
  454. begin{center}
  455. begin{mpost*}[mpmem = metafun]
  456. u := 1.75cm;
  457. pair A, B, C; A = origin; B = (0.5, 1.5); C = A + 1.5*(B-A) rotated -90;
  458. freelabel("$A$", A*u, u*0.5[B,C]); label.top("$B$", B*u); label.lrt("$C$", C*u);
  459. pythagorean_config(A, B, C, "$c$", "$a$", "$b$")(withcolor red);
  460. mark_right_angle(B, A, C);
  461. end{mpost*}
  462. end{center}
  463. end{document}
  464.  
  465. documentclass{article}
  466. usepackage{tkz-euclide}
  467. usetkzobj{all}
  468.  
  469. begin{document}
  470.  
  471. begin{tikzpicture}
  472. tkzInit
  473. tkzDefPoint(0,0){C}
  474. tkzDefPoint(4,0){A}
  475. tkzDefPoint(0,3){B}
  476. tkzDefSquare(B,A)tkzGetPoints{E}{F}
  477. tkzDefSquare(A,C)tkzGetPoints{G}{H}
  478. tkzDefSquare(C,B)tkzGetPoints{I}{J}
  479. tkzFillPolygon[fill = red!50 ](A,C,G,H)
  480. tkzFillPolygon[fill = blue!50 ](C,B,I,J)
  481. tkzFillPolygon[fill = green!50](B,A,E,F)
  482. tkzFillPolygon[fill = orange,opacity=.5](A,B,C)
  483. tkzDrawPolygon[line width = 1pt](A,B,C)
  484. tkzDrawPolygon[line width = 1pt](A,C,G,H)
  485. tkzDrawPolygon[line width = 1pt](C,B,I,J)
  486. tkzDrawPolygon[line width = 1pt](B,A,E,F)
  487. tkzLabelSegment[auto](A,C){$a$}
  488. tkzLabelSegment[auto](C,G){$a$}
  489. tkzLabelSegment[auto](G,H){$a$}
  490. tkzLabelSegment[auto](H,A){$a$}
  491. tkzLabelSegment[auto](C,B){$b$}
  492. tkzLabelSegment[auto](B,I){$b$}
  493. tkzLabelSegment[auto](I,J){$b$}
  494. tkzLabelSegment[auto](J,C){$b$}
  495. tkzLabelSegment[auto](B,A){$c$}
  496. tkzLabelSegment[auto](F,B){$c$}
  497. tkzLabelSegment[auto](E,F){$c$}
  498. tkzLabelSegment[auto](A,E){$c$}
  499. end{tikzpicture}
  500.  
  501. end{document}
  502.  
  503. documentclass[landscape]{article}
  504. usepackage{pstricks,geometry}
  505.  
  506. newpsstyle{aStyle}{linecolor=red,fillstyle=solid,fillcolor=red!30}
  507. newpsstyle{bStyle}{linecolor=green,fillstyle=solid,fillcolor=green!30}
  508. newpsstyle{cStyle}{linecolor=blue,fillstyle=solid,fillcolor=blue!30}
  509. makeatletter
  510. defpsRTriangle{pst@object{psRTriangle}}
  511. defpsRTriangle@i(#1,#2){%
  512. addbefore@par{dimen=middle}%
  513. begin@SpecialObj
  514. pspolygon(0,0)(#1,0)(#1,#2)
  515. end@SpecialObj
  516. psframe[style=aStyle](!#1 dup neg)
  517. psframe[style=bStyle,origin={#1,0}](#2,#2)
  518. rput{!#2 #1 atan}(0,0){%
  519. psframe[style=cStyle](!#1 #2 Pyth dup)
  520. psarc(!#1 #2 Pyth dup){0.5}{180}{270}psdot(!#1 #2 Pyth 0.2 sub dup)
  521. uput[90](!#1 #2 Pyth 2 div 0){c}uput[180](!#1 #2 Pyth dup 2 div){c}}
  522. psarc(#1,0){0.5}{90}{180}psdot(!#1 0.2 sub 0.2)
  523. psarcn(#1,0){0.5}{90}{0}psdot(!#1 0.2 add 0.2)
  524. psarc(!#1 #2 add #2){0.5}{180}{270}psdot(!#1 #2 add 0.2 sub #2 0.2 sub)
  525. psarc(0,0){0.5}{!#2 #1 atan}{!#2 #1 atan 90 add}psdot(!#2 #1 atan rotate 0.2 0.2)
  526. psarcn(0,0){0.5}{0}{-90}psdot(0.2,-0.2)
  527. psarc(!#1 dup neg){0.5}{90}{180}psdot(!#1 0.2 sub dup neg)
  528. uput[200](0,0){A}uput[45](#1,#2){B}uput[-45](#1,0){C}
  529. uput[0](!#1 #2 2 div){a} uput[-90](!#1 #2 2 div add 0){a}
  530. uput[-90](!#1 2 div 0){b}uput[0](!0 #1 2 div neg){b}}
  531. makeatother
  532.  
  533. begin{document}
  534.  
  535. begin{pspicture}(-2,-5)(14,7)
  536. psRTriangle(3,2)
  537. newpsstyle{cStyle}{fillstyle=solid,fillcolor=magenta!20!black!20}
  538. rput(7,0){psRTriangle[fillstyle=solid,fillcolor=yellow](5,1.5)}
  539. end{pspicture}
  540.  
  541. end{document}
  542.  
  543. documentclass{article}
  544.  
  545. usepackage{pst-eucl,pstricks-add}
  546.  
  547. % calculating frame size of pspicture
  548. usepackage{expl3}
  549. ExplSyntaxOn
  550. cs_new_eq:NN calc fp_eval:n
  551. ExplSyntaxOff
  552. newcommand*maxHori{calc{lengthA+2*lengthB}}
  553. newcommand*maxVert{calc{2*lengthA+lengthB}}
  554.  
  555. % labels
  556. defLabel[#1]#2#3{%
  557. pcline[linestyle = none, offset = -8pt](#2)(#3)
  558. ncput{$#1$}}
  559.  
  560. % length of the catheti
  561. deflengthA{3 }
  562. deflengthB{2 }
  563.  
  564.  
  565. begin{document}
  566.  
  567. begin{pspicture}(maxHori,maxVert)
  568. psset{dimen = middel, fillstyle = solid}
  569. pnodes%
  570. (!lengthA lengthB add lengthA lengthB add){A}%
  571. (lengthB,lengthA){B}%
  572. (!lengthA lengthB add lengthA){C}%
  573. (lengthB,0){a1}%
  574. (!lengthA lengthB add 0){a2}%
  575. (!lengthA 2 lengthB mul add lengthA lengthB add){b1}%
  576. (!lengthA 2 lengthB mul add lengthA){b2}%
  577. (!0 2 lengthA mul){c1}%
  578. (!lengthA 2 lengthA mul lengthB add){c2}
  579. psframe[fillcolor = red!70](a1)(C)
  580. psframe[fillcolor = blue!70](C)(b1)
  581. pspolygon[fillcolor = yellow!70](B)(c1)(c2)(A)
  582. pspolygon[fillcolor = green!70](A)(C)(B)
  583. pstRightAngle[RightAngleSize = 0.3, fillstyle = solid, fillcolor = green!70]{A}{C}{B}
  584. uput[60](A){$A$}
  585. uput[210](B){$B$}
  586. uput[315](C){$C$}
  587. Label[a]{a1}{B}
  588. Label[a]{B}{C}
  589. Label[a]{C}{a2}
  590. Label[a]{a2}{a1}
  591. Label[b]{C}{A}
  592. Label[b]{A}{b1}
  593. Label[b]{b1}{b2}
  594. Label[b]{b2}{C}
  595. Label[c]{B}{c1}
  596. Label[c]{c1}{c2}
  597. Label[c]{c2}{A}
  598. Label[c]{A}{B}
  599. end{pspicture}
  600.  
  601. end{document}
  602.  
  603. documentclass[pstricks]{standalone}
  604. usepackage{pst-eucl,pst-plot}
  605.  
  606. defS#1#2#3{% #1: semi-width, #2: label, #3: fillcolor
  607. begin{pspicture}[plotpoints=5](-#1,-#1)(#1,#1)
  608. curvepnodes{0}{360}{#1 2 sqrt mul t 45 add PtoC}{#2}
  609. pspolygon[fillstyle=solid,fillcolor=#3!50](#20)(#21)(#22)(#23)
  610. psset{linestyle=none,offset=.1}
  611. multido{ix=0+1,iy=1+1}{4}{ncline{#2ix}{#2iy}naput{$#2$}}
  612. end{pspicture}}
  613.  
  614. begin{document}
  615. begin{pspicture}(-4,-5)(8,8)
  616. pstGeonode[PosAngle={-135,-45,45},PointSymbol=none]{A}(4,0){C}(4,3){B}
  617. pstRightAngle{A}{C}{B}
  618. rput[tl](A){S{2}{b}{red}}
  619. rput[bl](C){S{1.5}{a}{green}}
  620. rput[br]{(B)}(B){S{2.5}{c}{blue}}
  621. end{pspicture}
  622.  
  623. end{document}
  624.  
  625. documentclass[tikz,border=1cm]{standalone}
  626. usetikzlibrary{calc}
  627. tikzset{square/.style= { to path={
  628. --node[auto=right]{#1} (tikztotarget)
  629. --node[auto=right]{#1} ($(tikztotarget)!1!90:(tikztostart)$)
  630. --node[auto=right]{#1} ($(tikztostart)!1!-90:(tikztotarget)$)
  631. --node[auto=right]{#1} (tikztostart) (tikztotarget)}}}
  632.  
  633. begin{document}
  634. begin{tikzpicture}[very thick]
  635. draw (0,0) to[square=a] (3,0) to[square=b] (3,2) to[square=c] (0,0);
  636. end{tikzpicture}
  637. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement