Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 3
noch eine Version für cis

02 Mär '15, 14:15

esdd's gravatar image

esdd
17.8k304257

Auf Anregung von @cis ist hier noch eine Alternative, bei der der Abstand zwischen den Punkten `(A)` und `(C)` bestimmt wird und dann ein quadratischer Node mit diesem Abstand als Kantenlänge auf der Dreieckseite eingefügt wird. \documentclass[border=2pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (6,0); \path[name path=a] (B) -- ++(150:5.5); \path[name path=b] (A) -- ++(60:3.5); \path[name intersections={of=a and b}] (intersection-1) coordinate (C); \draw (A) -- (B) --(C) -- (A); \path let \p1=($(C)-(A)$), \n1={veclen(\x1,\y1)} in (A)node[draw,blue,dashed,very thick, minimum size=\n1, outer sep=0pt,inner sep=0pt, anchor=south west, rotate=60 ]{}; \end{tikzpicture} \end{document} ![alt text][1] ---------- Da @cis sich das Quadrat als Dekoration der Strecke vorstellt, ist hier ein noch etwas umständlicherer Vorschlag, bei dem zusätzlich die `decorations.shapes` Bibliothek benötigt wird. \documentclass[border=2pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \usetikzlibrary{calc} \usetikzlibrary{decorations.shapes} \tikzset{ decorate with square/.style={ decorate, outer sep=0pt, decoration={ shape backgrounds, shape=rectangle, anchor=south, shape size=#1, shape evenly spread=1 } } } \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (6,0); \path[name path=a] (B) -- ++(150:5.5); \path[name path=b] (A) -- ++(60:3.5); \path[name intersections={of=a and b}] (intersection-1) coordinate (C); \draw (A) -- (B) --(C) -- (A); \path let \p1=($(C)-(A)$), \n1={veclen(\x1,\y1)} in [draw=green,dashed,very thick,decorate with square=\n1] (A)--(C); \end{tikzpicture} \end{document} Ergebnis: ![alt text][2] ---------- Und da @cis unbedingt lieber ein `regular polygon` statt einem einfachen `rectangle` haben möchte, hier eine weitere Version, bei der dann auch noch die Bibliothek `shapes.geometric` geladen werden muss: \documentclass[border=2pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \usetikzlibrary{calc} \usetikzlibrary{decorations.shapes,shapes.geometric} \tikzset{ decorate with square/.style={ decorate, outer sep=0pt, decoration={ shape backgrounds, shape=regular polygon, anchor=south, shape size=#1, shape evenly spread=1 }, regular polygon sides=4 } } \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (6,0); \path[name path=a] (B) -- ++(150:5.5); \path[name path=b] (A) -- ++(60:3.5); \path[name intersections={of=a and b}] (intersection-1) coordinate (C); \draw (A) -- (B) --(C) -- (A); \path let \p1=($(C)-(A)$), \n1={veclen(\x1,\y1)} in [draw=orange,dashed,very thick,decorate with square=\n1] (A)--(C); \end{tikzpicture} \end{document} ![alt text][3] [1]: http://texwelt.de/wissen/upfiles/tw_drmqu1.png [2]: http://texwelt.de/wissen/upfiles/tw_qudreieck.pnghttp://texwelt.de/wissen/upfiles/tw_qudreieck.png [3]: http://texwelt.de/wissen/upfiles/tw_fuercis.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2
Variante als Pfaddekoration

01 Mär '15, 23:31

esdd's gravatar image

esdd
17.8k304257

Auf Anregung von @cis ist hier noch eine Alternative, bei der der Abstand zwischen den Punkten `(A)` und `(C)` bestimmt wird und dann ein quadratischer Node mit diesem Abstand als Kantenlänge auf der Dreieckseite eingefügt wird. \documentclass[border=2pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (6,0); \path[name path=a] (B) -- ++(150:5.5); \path[name path=b] (A) -- ++(60:3.5); \path[name intersections={of=a and b}] (intersection-1) coordinate (C); \draw (A) -- (B) --(C) -- (A); \path let \p1=($(C)-(A)$), \n1={veclen(\x1,\y1)} in (A)node[draw,blue,dashed,very thick, minimum size=\n1, outer sep=0pt,inner sep=0pt, anchor=south west, rotate=60 ]{}; \end{tikzpicture} \end{document} ![alt text][1] ---------- Da @cis sich das Quadrat als Dekoration der Strecke vorstellt, ist hier ein noch etwas umständlicherer Vorschlag, bei dem zusätzlich die `decorations.shapes` Bibliothek benötigt wird. \documentclass[border=2pt]{standalone} \usepackage{tikz} \usetikzlibrary{intersections} \usetikzlibrary{calc} \usetikzlibrary{decorations.shapes} \tikzset{ decorate with square/.style={ decorate, outer sep=0pt, decoration={ shape backgrounds, shape=rectangle, anchor=south, shape size=#1, shape evenly spread=1 } } } \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (6,0); \path[name path=a] (B) -- ++(150:5.5); \path[name path=b] (A) -- ++(60:3.5); \path[name intersections={of=a and b}] (intersection-1) coordinate (C); \draw (A) -- (B) --(C) -- (A); \path let \p1=($(C)-(A)$), \n1={veclen(\x1,\y1)} in [draw=green,dashed,very thick,decorate with square=\n1] (A)--(C); \end{tikzpicture} \end{document} Ergebnis: ![alt text][2] [1]: http://texwelt.de/wissen/upfiles/tw_drmqu1.pnghttp://texwelt.de/wissen/upfiles/tw_drmqu1.png [2]: http://texwelt.de/wissen/upfiles/tw_qudreieck.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

28 Feb '15, 21:56

esdd's gravatar image

esdd
17.8k304257