TransWikia.com

How does the `smooth` option in `draw' works

TeX - LaTeX Asked on March 20, 2021

While drawing a curve in tikz, the smooth option in draw command makes the output much desired, smooth, and nice to eyes. I want to know how does it do that. To get the same output without the smooth option, one must increase the number of intermediate nodes, resulting in much higher compilation time. For example, the following MWE

documentclass{article}
usepackage{tikz}
begin{document}
    begin{tikzpicture}
        draw [smooth, samples=10, domain=-1:1] plot (x,{x*x*x});
        draw [samples=1000, domain=-1:1] plot (x,{x*x*x-0.1});
    end{tikzpicture}
end{document}

produces almost same figures. One needs to really zoom in and nitpick to find the difference. I wonder how does smooth complete this job without taking more compilation time.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP