Home>tikz pgf>
Draw a closed liquid-droped shaped curve with TikZ

Draw a closed liquid-droped shaped curve with TikZ

September 22Hits:5

Advertisement

I am trying to draw a closed liquid-droped shaped curve using TikZ, but I don't know how. I tried to draw it using coordinates but I don't think that this is the solution. I am using

From the comments seems clear I misunderstood the question; a belated attempt to remedy (of course with hobby) :):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
Completely closed:
\begin{center}
\begin{tikzpicture}
\draw[orange, very thick] (0,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0,4);
\foreach \place/\el in {{(0,1.2)/-},{(0,2.8)/-},{(-0.5,0.8)/+},{(0.55,1)/-},{(-0.2,1.7)/-},{(0.1,2)/+},{(0.55,1.5)/+},{(0.2,0.5)/+},{(-0.2,0.2)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
\end{center}
Not closed:
\begin{center}
\begin{tikzpicture}
\draw[orange, very thick] (-0.035,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0.035,4);
\foreach \place/\el in {{(0,1.2)/-},{(0,2.8)/-},{(-0.5,0.8)/+},{(0.55,1)/-},{(-0.2,1.7)/-},{(0.1,2)/+},{(0.55,1.5)/+},{(0.2,0.5)/+},{(-0.2,0.2)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
\end{center}
\end{document}

Result:

Since Garbage Collector posted a very nice PSTricks gif animation, it sounds to me that we should have also a TikZ-based version. Basically, the standalone class with the tikz option allows to create several pdf pages, the base of the animation. The + and - signs change position in each page because their coordinates are generated by random numbers, the function rnd which generates number from 0 to 1. That's why each time a random number is created, it is multiplied by a constant factor that amplifies and bounds the positions in which each sign will be placed.

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\foreach \number in {1,...,20}{
\begin{tikzpicture}[scale=2]
\draw[orange, very thick] (0,4) to[curve through={(-0.45,2)..(-0.9,0) .. (0.9,0) .. (0.45,2)}] (0,4);
\foreach \place/\el in {{(rnd*0.8,rnd*1.05)/-},{(rnd*0.05,rnd*2.8)/-},{(-rnd*0.5,0.8)/+},{(rnd*0.55,rnd*1.1)/-},{(-rnd*0.2,rnd*1.7)/-},{(rnd*0.4,1.8)/+},{(rnd*0.55,1.5)/+},{(rnd*0.9,rnd*0.9)/+},{(-rnd*0.9,rnd*0.4)/-}}
\node at \place {\ensuremath{\el}};
\end{tikzpicture}
}
\end{document}

Result:

Just for fun with PSTricks.

Still Version:

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pstricks-add}
\def\N{15}
\begin{document}
\begin{pspicture}[showgrid=false](-2,-2)(2,5)
\psclip{\psbezier[linestyle=none](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)}
\psLoop{\N}{
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$+$}
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$-$}}%
\endpsclip
\psbezier[linecolor=orange](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)
\end{pspicture}
\end{document}

GIF Version:

\documentclass[pstricks,border=3pt]{standalone}
\usepackage{pstricks-add}
\def\N{15}
\begin{document}
\psLoop{20}{%
\begin{pspicture}[showgrid=false](-2,-2)(2,5)
\psclip{\psbezier[linestyle=none](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)}
\psLoop{\N}{
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$+$}
\rput(!rand 21 mod 10 div 1 sub rand 51 mod 10 div 1 sub){$-$}}%
\endpsclip
\psbezier[linecolor=orange](0,5)(-6.8,-4.3)(6.8,-4.3)(0,5)
\end{pspicture}}
\end{document}

I am trying to draw a closed liquid-droped shaped curve using TikZ, but I don't know how. I tried to draw it using coordinates but I don't think that this is the solution. I am using \documentclass{article} \usepackage{tikz} \begin{document} \begin{f

I want to create some bell shaped curves for demonstrating hypothesis testing in statistics. Can anybody help me drawing curves like shown in the following picture? --------------Solutions------------- I would use pgfplots for this, as I find it easi

I want to draw straight lines along a smooth path in tikz. I tried to use the decorations.markings-solution described in Drawing paths/nodes along a path in Tikz and used it like this: \documentclass{article} \usepackage[latin1]{inputenc} \usepackage

I have the following code: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[scale=1] \def\normalt{\x,{4*1/exp(((\x-3)^2)/2)}} \def\y{2} \def\fy{4*1/exp(((\y-3)^2)/2)} \fill [fill=orange!60] (2.0,0)--(2.0,2.5) plot[domain

Karl is a list of randomly generated nodes by \curvepnodes using parametric points in RPN (I don't know how to use rand in algebraic expression). The number of elements of the list is \Karlnodecount + 1 or plotpoints. In the documentation, I only see

This is the final part of the series on drawing tools in Illustrator. In the last post we looked at how to use the Pen tool to draw straight line segments and how to use the Selection tools to edit entire paths and individual points. To conclude the

Possible Duplicate: Easy curves in TikZ I want to draw an equivalent of the following pstricks picture with tikz. \documentclass{article} \usepackage{pstricks} \usepackage{pst-plot} \begin{document} \begin{pspicture} \psaxes[ticks=none,labels=none]{-

I got a nice code to draw an arrow at the mid position of the curve. From Tikz: Arrowheads in the center \tikzset{->-/.style={decoration={ markings, mark=at position .5 with {\arrow{>}}},postaction={decorate}}} I do not know how to make a dot some w

I want to draw a closed line in QGIS1.8,but I don't know how to make the last point coincide with the first point.What am I supposed to do? --------------Solutions------------- Set the Snapping Options: This is a previous answer on GIS SE How to join

Is it possible to compute the length of a generic curve in TikZ? An answer to this question would solve TikZ dashes and closed curves as follows: Let lc be the length of the curve and lp the desired length of the dash pattern. All we have to do is re

I want to draw labeled parallel arrow in commutative diagram with TikZ, I searched on google and Tex Stackexchange, however, I found only the method to draw parallel arrow by transform canvas only, I tried to add the labeled but it failed. Here is my

This is my tikz code to draw some plots. \documentclass{article} \usepackage{tikz,subfig} \begin{document} \begin{figure} \centering \subfloat[Iteration Domain for a Tile]{ \begin{tikzpicture} \draw (0,0) rectangle (3.8,3.8); \end{tikzpicture} } \sub

Background: This is an extension problem from my last post How to draw the recursive H-Layout tree using Tikz?. The (2D) H-layout tree is actually from the VLSI layout problem in computer science. I have received excellent solutions to the last post.

I would like to draw an image illustriting peer-to-peer communications in Tikz. I have previously drawn flowcharts with relative ease based on the Simple Flowchart Example. Here is the image that I would like to recreate in Tikz: My difficulties are:

I want to draw the mirror image of an inductor in TikZ so that if the devices is drawn horizontally then the bumps are on the lower side rather than the upper side. Does someone have an idea of how this could be done? Help would be appreciated greatl

So I'm trying to draw a circle in a nonstandard plane with TikZ, but can't seem to find any documentation. I originally tried what was found here: Drawing a circle on a non xy-plane with TikZ But this doesn't answer my question as this just changes f

I'm trying to draw some arbitrary closed two dimensional curve where I'm focusing on only part of the boundary. I want to label the diameter of the part of the boundary I'm focusing on. Last, I'd like to put a tube encompassing this part of the bound

I want to draw the following diagram. I have tried with the following Latex command: \documentclass[12pt,twoside,a4paper]{book} \usepackage{graphicx,wrapfig,tikz} \begin{document} \begin{tikzpicture} \draw (0,4) ellipse ( 2cm and .6cm); \draw (2,4) -

I'm trying to draw a boundary around a convex set of circular nodes in TikZ. The aim is to have it padded by 1cm, with an arc at the corners between segments, like this: I currently have the following code: \documentclass{article} \usepackage{tikz} \

I want to draw an arbitrary closed surface like following figure. How can i do it? Here is the MWE: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \shade[line width=2pt, color=blue] (0, 0) .. controls(1,2) .. (3, 0) ;