Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am somewhat starting to get acustomed to tikz now. But I am trying to reproduce the image below in tikz

Polygon

I have managed to make the triangle (I think?) using tikz, now I have no idea how to make the woobbly part around the image. I did look into such things as parabolas, but did not make it work. I did som reading about beltzier curves, however that left me even more puzzled.

My code so far

 \documentclass{article}
 \usepackage{mathtools}
 \usepackage{amsfonts}
 \usepackage{amssymb}
 \usepackage{amsmath}
 \usepackage{tikz}
 \usetikzlibrary{calc}
 \usetikzlibrary{backgrounds}
 \usepgflibrary{shapes}
 \usetikzlibrary{through}
 \usetikzlibrary{arrows}
 \usepackage{tkz-euclide}
 \usetkzobj{all}
 \begin{document}

 \begin{tikzpicture}[scale=1.4,label]
 \tkzInit[xmin=-1 , xmax=14 , ymin=-1 , ymax=5]
 \tkzClip
 \tkzDefPoint(0,0){A} \tkzDefPoint(10,0){B}  
 \tkzDefPointBy[rotation= center B angle -15.4](A)
 \tkzGetPoint{C}
 \tkzDefPointBy[rotation= center A angle  69.7](B)
 \tkzGetPoint{D}
 \tkzDrawSegment[very thick](A,B)
 \tkzInterLL(A,D)(C,B) \tkzGetPoint{I}
 \tkzDrawSegments[dashed](A,I I,B)
 \tkzDefMidPoint(A,I) \tkzGetPoint{M}
 \tkzMarkAngle[scale=0.75,dashed](A,I,B)
 \tkzMarkAngle[scale=0.75,dashed](B,A,I)
 \tkzDrawPoints[color=black,shape=circle,fill=red,size=10pt](A,I,B)
 \tkzLabelPoint[left](M){$40.0m$} 
 \tkzLabelPoint[right](B){\Large $B$} 
 \tkzLabelPoint[left](A){\Large $A$} 
 \tkzLabelPoint[above left](I){\Large $C$} 
 \tkzLabelAngle[pos=0.8](A,I,B){ $94.9^{\circ}$ }
 \tkzLabelAngle[pos=0.9 ](B,A,I){ $69.7^{\circ}$ }
 \end{tikzpicture}

 \end{document}     

Could someone please hint or show how to produce an somewhat arbitary shaded blob / polygon in latex? Another problem is that my blob needs to look as close as possible to the one in the image above.

share|improve this question
add comment

1 Answer 1

up vote 13 down vote accepted

You can use the random steps decoration from the decorations.pathmorphing library, combined with rounded corners to create something similar.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}

 \begin{tikzpicture}[label]
 \tkzInit[xmin=-1.5 , xmax=14 , ymin=-3 , ymax=5]
 \tkzClip
 \tkzDefPoint(0,0){A} \tkzDefPoint(10,0){B}  
 \tkzDefPointBy[rotation= center B angle -15.4](A)
 \tkzGetPoint{C}
 \tkzDefPointBy[rotation= center A angle  69.7](B)
 \tkzGetPoint{D}
 \tkzDrawSegment[very thick](A,B)
 \tkzInterLL(A,D)(C,B) \tkzGetPoint{I}
 \tkzDrawSegments[dashed](A,I I,B)
 \tkzDefMidPoint(A,I) \tkzGetPoint{M}
 \tkzMarkAngle[scale=0.75,dashed](A,I,B)
 \tkzMarkAngle[scale=0.75,dashed](B,A,I)
 \tkzDrawPoints[color=black,shape=circle,fill=red,size=10pt](A,I,B)
 \tkzLabelPoint[left](M){40.0\,m} 
 \tkzLabelPoint[right](B){\Large $B$} 
 \tkzLabelPoint[left](A){\Large $A$} 
 \tkzLabelPoint[above left](I){\Large $C$} 
 \tkzLabelAngle[pos=0.8](A,I,B){ $94.9^{\circ}$ }
 \tkzLabelAngle[pos=0.9 ](B,A,I){ $69.7^{\circ}$ }
 \draw [shade,
        top color=blue,
        bottom color=white,
        fill opacity=.1,
        decoration={random steps,segment length=1cm,amplitude=.5cm},
        decorate,
        rounded corners=.3cm]
     (A) -- (0.4,0.7)  -- (5,3.1) -- (B) -- (10,-1) -- (1.6,-1.5) -- (A);
 \end{tikzpicture}

 \end{document}

As the effect of the decoration is somewhat, well, random, your output may differ from this.

enter image description here


If the blob has to be almost identical to the one in your image, it would perhaps be easier to draw the path manually in e.g. Inkscape and export to TikZ code with inkscape2tikz. (There may be other tools that allow you to do this, but I knew about these, so that's what I used.)

The code isn't exactly pretty, and I had to shift and scale it manually to make it fit with the existing drawing, but that didn't take too long.

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}

 \begin{tikzpicture}[label]
 \tkzInit[xmin=-1.5 , xmax=14 , ymin=-3 , ymax=5]
 \tkzClip
 \tkzDefPoint(0,0){A} \tkzDefPoint(10,0){B}  
 \tkzDefPointBy[rotation= center B angle -15.4](A)
 \tkzGetPoint{C}
 \tkzDefPointBy[rotation= center A angle  69.7](B)
 \tkzGetPoint{D}
 \tkzDrawSegment[very thick](A,B)
 \tkzInterLL(A,D)(C,B) \tkzGetPoint{I}
 \tkzDrawSegments[dashed](A,I I,B)
 \tkzDefMidPoint(A,I) \tkzGetPoint{M}
 \tkzMarkAngle[scale=0.75,dashed](A,I,B)
 \tkzMarkAngle[scale=0.75,dashed](B,A,I)
 \tkzDrawPoints[color=black,shape=circle,fill=red,size=10pt](A,I,B)
 \tkzLabelPoint[left](M){40.0\,m} 
 \tkzLabelPoint[right](B){\Large $B$} 
 \tkzLabelPoint[left](A){\Large $A$} 
 \tkzLabelPoint[above left](I){\Large $C$} 
 \tkzLabelAngle[pos=0.8](A,I,B){ $94.9^{\circ}$ }
 \tkzLabelAngle[pos=0.9 ](B,A,I){ $69.7^{\circ}$ }
 \begin{scope}[x=0.01cm,y=-0.01cm,shift={(-67,-380)},scale=1.18]
  \path[draw=black,
        shade,
        top color=blue,
        bottom color=white,
        fill opacity=.1] (324.2857,37.4286) .. controls (324.2857,37.4286)
    and (375.7143,8.8571) .. (402.8571,8.8571) .. controls (537.1429,8.8571) and
    (594.9022,229.4892) .. (645.7143,237.4286) .. controls (691.4286,244.5714) and
    (687.1428,196.0000) .. (732.8571,196.0000) .. controls (761.5711,196.0000) and
    (819.9039,267.6222) .. (854.2857,284.5714) .. controls (872.0828,293.3449) and
    (898.1530,287.6641) .. (904.2857,310.2857) .. controls (908.4648,325.7012) and
    (915.4588,428.9108) .. (880.9086,428.5105) .. controls (859.7549,428.2654) and
    (847.9021,422.6772) .. (834.2857,418.8571) .. controls (820.2451,414.9181) and
    (814.2857,393.1429) .. (782.8571,390.2857) .. controls (751.4286,387.4286) and
    (711.4514,402.4931) .. (680.0000,401.7143) .. controls (622.3075,400.2857) and
    (496.2045,334.2248) .. (450.4902,341.3677) .. controls (404.7759,348.5105) and
    (370.8368,402.6229) .. (326.5511,406.8368) .. controls (282.3729,411.0405) and
    (224.1124,380.4590) .. (176.9695,380.4590) .. controls (129.8267,380.4590) and
    (114.2857,408.8571) .. (102.8571,408.8571) .. controls (91.4286,408.8571) and
    (43.7959,397.5021) .. (43.8673,366.6635) .. controls (43.9391,335.6534) and
    (128.3263,212.2045) .. (158.3263,199.3474) .. controls (188.3263,186.4902) and
    (228.5714,164.5714) .. (237.1429,153.1429) .. controls (245.7143,141.7143) and
    (231.4286,86.0000) .. (254.2857,71.7143) .. controls (277.1429,57.4286) and
    (324.2857,37.4286) .. (324.2857,37.4286) -- cycle;
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
By the way, got the tip about rounded corners from this: tex.stackexchange.com/questions/33655/… –  Torbjørn T. Nov 20 '11 at 22:04
    
It is close but not quite, will to to export the file to eps, then transform it into tikz. If not I guess your answer is the simplest one. I tried defining more points, but the image did not improve. –  N3buchadnezzar Nov 20 '11 at 23:21
    
@N3buchadnezzar It's a little tedious I think to "control" the result (it's (pseudo)random, so you can't control it fully). Trial and error, adding/removing/moving points and varying segment length, amplitude and the radius for the rounded corners. If you need the shape to be almost exactly like the one in the image though, you're probably better off drawing it manually in e.g Inkscape and exporting to TikZ code. I'll add an example of that soon. –  Torbjørn T. Nov 20 '11 at 23:43
    
@N3buchadnezzar You could also use \draw plot[smooth] coordinates {(A) (x,y) ...};, but finding the right coordinates will take some time. (A grid would help with that.) –  Torbjørn T. Nov 20 '11 at 23:45
    
Haha exellent. I was just fiddling around in geogebra trying to make the same image. I find that doing ugly things both in geogebra, and tikz is hard. Or should i rather say random ^^ –  N3buchadnezzar Nov 21 '11 at 0:12
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.