|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Spread decorations evenly on a circleHi
I have an issue with the pgf decorations. I want to visualize how lipid molecules are ordered inside a vesicle[1]. For doing that I have defined a new decoration "lipidleaflet" and the goal were then to draw two concentric circles with the decoration. Unfortunately are the draw repetitions of the decoration not evenly distributed, which leaves a gap in the right side of the structure. Can this be fixed _without_ manually adjusting the diameter of the drawn circles? An idea might be to "measure" the length of the path that should be decorated, calculate the number of repeated decorations and finally adjust the width of the decoration. Henrik Skov Midtiby [1] http://en.wikipedia.org/wiki/File:Lipid_vesicles.svg % ====================== \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations,decorations.pathreplacing} \begin{document} % Define decoration \pgfdeclaredecoration{lipidleaflet}{initial} { \state{initial}[width=7pt] { \pgfpathmoveto{\pgfpoint{3.5pt}{0pt}} \pgfpathlineto{\pgfpoint{3.5pt}{-10pt}} \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} \pgfpathlineto{\pgfpoint{5.5pt}{-10pt}} \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} \pgfpathcircle{\pgfpoint{4.5pt}{2pt}}{2.5pt} } \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % Draw a vesicle composed of two lipid layers \begin{tikzpicture} \draw[decorate, decoration={lipidleaflet}] (0, 0) circle (2.5cm); \draw[decorate, decoration={lipidleaflet, mirror}] (0, 0) circle (3.3cm); \end{tikzpicture} \end{document} ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Spread decorations evenly on a circleHi,
Fortunately, PGF does measure the length of a path for decorations (OK, it approximates the length of the path *reasonably* well). The length is contained in \pgfdecoratedpathlength, so you could say \state{initial}[width=\pgfdecoratedpathlength/20] or something similar. Regards Mark 2009/2/25 <henrikmidtiby@...>: > Hi > > I have an issue with the pgf decorations. I want to visualize how > lipid molecules are ordered inside a vesicle[1]. For doing that I > have defined a new decoration "lipidleaflet" and the goal were > then to draw two concentric circles with the decoration. > > Unfortunately are the draw repetitions of the decoration not > evenly distributed, which leaves a gap in the right side of the > structure. Can this be fixed _without_ manually adjusting the > diameter of the drawn circles? > > An idea might be to "measure" the length of the path that > should be decorated, calculate the number of repeated > decorations and finally adjust the width of the decoration. > > Henrik Skov Midtiby > > [1] http://en.wikipedia.org/wiki/File:Lipid_vesicles.svg > > > % ====================== > > \documentclass{article} > \usepackage{tikz} > \usetikzlibrary{decorations,decorations.pathreplacing} > > \begin{document} > > % Define decoration > \pgfdeclaredecoration{lipidleaflet}{initial} > { > \state{initial}[width=7pt] > { > \pgfpathmoveto{\pgfpoint{3.5pt}{0pt}} > \pgfpathlineto{\pgfpoint{3.5pt}{-10pt}} > \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} > \pgfpathlineto{\pgfpoint{5.5pt}{-10pt}} > \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} > \pgfpathcircle{\pgfpoint{4.5pt}{2pt}}{2.5pt} > } > \state{final} > { > \pgfpathmoveto{\pgfpointdecoratedpathlast} > } > } > > % Draw a vesicle composed of two lipid layers > \begin{tikzpicture} > \draw[decorate, decoration={lipidleaflet}] (0, 0) circle (2.5cm); > \draw[decorate, decoration={lipidleaflet, mirror}] (0, 0) circle > (3.3cm); > \end{tikzpicture} > > \end{document} > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > pgf-users mailing list > pgf-users@... > https://lists.sourceforge.net/lists/listinfo/pgf-users > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
|
|
Re: Spread decorations evenly on a circleThanks for your input Mark
My solution were the following \state{initial}[width=\pgfdecoratedpathlength/floor(\pgfdecoratedpathlength/7pt)] which fits as many decorations as possible in the decorated path AND distributes them evenly. Best Henrik PS: The whole piece of code is given below. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations,decorations.pathreplacing} \begin{document} % Define decoration \pgfdeclaredecoration{lipidleaflet}{initial} { \state{initial}[width=\pgfdecoratedpathlength/floor(\pgfdecoratedpathlength/7pt)] { \pgfpathmoveto{\pgfpoint{3.5pt}{0pt}} \pgfpathlineto{\pgfpoint{3.5pt}{-10pt}} \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} \pgfpathlineto{\pgfpoint{5.5pt}{-10pt}} \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} \pgfpathcircle{\pgfpoint{4.5pt}{2pt}}{2.5pt} } \state{final} { \pgfpathmoveto{\pgfpointdecoratedpathlast} } } % Draw a vesicle composed of two lipid layers \begin{tikzpicture} \draw[decorate, decoration={lipidleaflet}] (0, 0) circle (2.5cm); \draw[decorate, decoration={lipidleaflet, mirror}] (0, 0) circle (3.3cm); \end{tikzpicture} \end{document} 2009/2/26 Mark Wibrow <m.wibrow@...>: > Hi, > > Fortunately, PGF does measure the length of a path for decorations > (OK, it approximates the length of the path *reasonably* well). The > length is contained in \pgfdecoratedpathlength, > so you could say \state{initial}[width=\pgfdecoratedpathlength/20] or > something similar. > > Regards > > Mark > > 2009/2/25 <henrikmidtiby@...>: >> Hi >> >> I have an issue with the pgf decorations. I want to visualize how >> lipid molecules are ordered inside a vesicle[1]. For doing that I >> have defined a new decoration "lipidleaflet" and the goal were >> then to draw two concentric circles with the decoration. >> >> Unfortunately are the draw repetitions of the decoration not >> evenly distributed, which leaves a gap in the right side of the >> structure. Can this be fixed _without_ manually adjusting the >> diameter of the drawn circles? >> >> An idea might be to "measure" the length of the path that >> should be decorated, calculate the number of repeated >> decorations and finally adjust the width of the decoration. >> >> Henrik Skov Midtiby >> >> [1] http://en.wikipedia.org/wiki/File:Lipid_vesicles.svg >> >> >> % ====================== >> >> \documentclass{article} >> \usepackage{tikz} >> \usetikzlibrary{decorations,decorations.pathreplacing} >> >> \begin{document} >> >> % Define decoration >> \pgfdeclaredecoration{lipidleaflet}{initial} >> { >> \state{initial}[width=7pt] >> { >> \pgfpathmoveto{\pgfpoint{3.5pt}{0pt}} >> \pgfpathlineto{\pgfpoint{3.5pt}{-10pt}} >> \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} >> \pgfpathlineto{\pgfpoint{5.5pt}{-10pt}} >> \pgfpathmoveto{\pgfpoint{5.5pt}{0pt}} >> \pgfpathcircle{\pgfpoint{4.5pt}{2pt}}{2.5pt} >> } >> \state{final} >> { >> \pgfpathmoveto{\pgfpointdecoratedpathlast} >> } >> } >> >> % Draw a vesicle composed of two lipid layers >> \begin{tikzpicture} >> \draw[decorate, decoration={lipidleaflet}] (0, 0) circle (2.5cm); >> \draw[decorate, decoration={lipidleaflet, mirror}] (0, 0) circle >> (3.3cm); >> \end{tikzpicture} >> >> \end{document} >> >> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise >> -Strategies to boost innovation and cut costs with open source participation >> -Receive a $600 discount off the registration fee with the source code: SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> pgf-users mailing list >> pgf-users@... >> https://lists.sourceforge.net/lists/listinfo/pgf-users >> > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ pgf-users mailing list pgf-users@... https://lists.sourceforge.net/lists/listinfo/pgf-users |
| Free embeddable forum powered by Nabble | Forum Help |