1

Is there a way in Tikz to draw a smooth curve that passes through some specified points without the need of specifying control points, like you can do in Asymptote?

For example, in Asymptote I can do

draw((0,0)..(100,0)..(100,100)..(0,100)..cycle);

to obtain a curve that looks like a circle.

What's the Tikz analogous for plain TeX?

9
  • 2
    Yes it's the hobby package.
    – percusse
    Jan 21, 2016 at 11:02
  • @percusse In the package documentation I see that hobby is written using LaTeX3. I am running Tikz on top of plain TeX, so I can't use hobby
    – User
    Jan 21, 2016 at 11:07
  • Then no there is none. Any reason to stick to plain?
    – percusse
    Jan 21, 2016 at 11:08
  • @percusse I am not really using plain TeX, but OPmac, which is a set of macros built upon plain TeX. The reason is that I like more OPmac than LaTeX
    – User
    Jan 21, 2016 at 11:14
  • Ah then you need to ask @wipet
    – percusse
    Jan 21, 2016 at 11:14

2 Answers 2

2

For this case perhaps plot coordinates with smooth cycle,tension=1 is useful. I borrowed and modified daleif's code.

enter image description here

\input tikz.tex
\baselineskip=12pt
\hsize=6.3truein
\vsize=8.7truein
We are working on
\tikzpicture[x=0.5mm,y=0.5mm]
\draw [smooth cycle,tension=1] plot coordinates {(0,0)(100,0)(100,100)(0,100)};
\endtikzpicture.
\bye
5
2

Page 30 in the tikz/pgf manual?

\input tikz.tex
\baselineskip=12pt
\hsize=6.3truein
\vsize=8.7truein
We are working on
\tikzpicture[x=1mm,y=1mm]
\draw (0,0) to (100,0) to (100,100) to (0,100) to cycle;

\endtikzpicture.
\bye

the default unit in tikz is cm, so (100,100) was a little large.

4
  • Doesn't this produce a square instead of something that looks like a circle?
    – User
    Jan 21, 2016 at 11:26
  • 1
    @User \draw (0,0) to[out=90,in=180] (50,50) to[out=0,in=90] (100,0) to[out=270,in=0] (50,-50) to[out=180,in=270] cycle; Jan 21, 2016 at 11:34
  • @TorbjørnT. This is not what I was looking for because you have to specify in and out directions, but it could be a good compromise :)
    – User
    Jan 21, 2016 at 11:40
  • @User I do not ue asymptote, so I do know know its details
    – daleif
    Jan 21, 2016 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .