TikZ/PGF draw algorithmWhy does rotating a circle alter its bounding box?Is there a way to draw TikZ lines on the “inside” or “outside” of a path?Tikz-PGF: Draw integral test plotHow can I draw an arc with varying line thickness?List of Algorithm: add “algorithm” labelExtract a part of a path and reuse it as part of a new oneDraw an algorithm graph with TikzAnimation on Convergence of A sequenceImproving TikZ potatoesHow draw this figure (spiral) in tikz?draw rectangle TikZ

What happens when the drag force exceeds the weight of an object falling into earth?

Many one decreasing function?

Antivirus for Ubuntu 18.04

Why did Dr. Strange keep looking into the future after the snap?

Why was Gemini VIII terminated after recovering from the OAMS thruster failure?

Are modes in jazz primarily a melody thing?

Why did Gendry call himself Gendry Rivers?

Why is the blank symbol not considered part of the input alphabet of a Turing machine?

Do the Zhentarim fire members for killing fellow members?

Can a player choose to add detail and flavor to their character's spells and abilities?

Extracting the parent, leaf, and extension from a valid path

All of my Firefox add-ons have been disabled suddenly, how can I re-enable them?

Learning how to read schematics, questions about fractional voltage in schematic

Crime rates in a post-scarcity economy

What's the 2-minute timer on mobile Deutsche Bahn tickets?

What calendar would the Saturn nation use?

Game artist computer workstation set-up – is this overkill?

Did any early RISC OS precursor run on the BBC Micro?

Function annotation with two or more return parameters

Why is the episode called "The Last of the Starks"?

An adjective or a noun to describe a very small apartment / house etc

I want to write a blog post building upon someone else's paper, how can I properly cite/credit them?

Bash prompt takes only the first word of a hostname before the dot

My C Drive is full without reason



TikZ/PGF draw algorithm


Why does rotating a circle alter its bounding box?Is there a way to draw TikZ lines on the “inside” or “outside” of a path?Tikz-PGF: Draw integral test plotHow can I draw an arc with varying line thickness?List of Algorithm: add “algorithm” labelExtract a part of a path and reuse it as part of a new oneDraw an algorithm graph with TikzAnimation on Convergence of A sequenceImproving TikZ potatoesHow draw this figure (spiral) in tikz?draw rectangle TikZ













3















I have TikZ code that draws an ellipse. Here is the code that, AFAIK, draws the actual ellipse:



draw [rotate around=0.:(0.,0.),line width=0.8pt] (0.,0.) ellipse (5.cm and 4.cm);


Can anyone tell me how draw actually produces the line-work, i.e., is it behind-the-scenes using an interpolation algorithm to create coordinate points?



I've used Geogebra to generate TikZ code of a graph, and occasionally it simply brute-forces the shape of a line or object by generating tons of individual coordinates, making it rather unwieldy to put into a LaTeX document.



This, however, suggests to me the actual drawing of a shape with just a one-liner like above is some sort of interpolation, i.e. plotting per the ellipse formula a minimum base set of points, then interpolating the rest to fill in between them. I've read that this is typical, since using the ellipse formula to produce all of the points would be very resource and time expensive. Does anyone know what is going on under the hood?










share|improve this question


























    3















    I have TikZ code that draws an ellipse. Here is the code that, AFAIK, draws the actual ellipse:



    draw [rotate around=0.:(0.,0.),line width=0.8pt] (0.,0.) ellipse (5.cm and 4.cm);


    Can anyone tell me how draw actually produces the line-work, i.e., is it behind-the-scenes using an interpolation algorithm to create coordinate points?



    I've used Geogebra to generate TikZ code of a graph, and occasionally it simply brute-forces the shape of a line or object by generating tons of individual coordinates, making it rather unwieldy to put into a LaTeX document.



    This, however, suggests to me the actual drawing of a shape with just a one-liner like above is some sort of interpolation, i.e. plotting per the ellipse formula a minimum base set of points, then interpolating the rest to fill in between them. I've read that this is typical, since using the ellipse formula to produce all of the points would be very resource and time expensive. Does anyone know what is going on under the hood?










    share|improve this question
























      3












      3








      3








      I have TikZ code that draws an ellipse. Here is the code that, AFAIK, draws the actual ellipse:



      draw [rotate around=0.:(0.,0.),line width=0.8pt] (0.,0.) ellipse (5.cm and 4.cm);


      Can anyone tell me how draw actually produces the line-work, i.e., is it behind-the-scenes using an interpolation algorithm to create coordinate points?



      I've used Geogebra to generate TikZ code of a graph, and occasionally it simply brute-forces the shape of a line or object by generating tons of individual coordinates, making it rather unwieldy to put into a LaTeX document.



      This, however, suggests to me the actual drawing of a shape with just a one-liner like above is some sort of interpolation, i.e. plotting per the ellipse formula a minimum base set of points, then interpolating the rest to fill in between them. I've read that this is typical, since using the ellipse formula to produce all of the points would be very resource and time expensive. Does anyone know what is going on under the hood?










      share|improve this question














      I have TikZ code that draws an ellipse. Here is the code that, AFAIK, draws the actual ellipse:



      draw [rotate around=0.:(0.,0.),line width=0.8pt] (0.,0.) ellipse (5.cm and 4.cm);


      Can anyone tell me how draw actually produces the line-work, i.e., is it behind-the-scenes using an interpolation algorithm to create coordinate points?



      I've used Geogebra to generate TikZ code of a graph, and occasionally it simply brute-forces the shape of a line or object by generating tons of individual coordinates, making it rather unwieldy to put into a LaTeX document.



      This, however, suggests to me the actual drawing of a shape with just a one-liner like above is some sort of interpolation, i.e. plotting per the ellipse formula a minimum base set of points, then interpolating the rest to fill in between them. I've read that this is typical, since using the ellipse formula to produce all of the points would be very resource and time expensive. Does anyone know what is going on under the hood?







      tikz-pgf algorithms draw






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 48 mins ago









      147pm147pm

      4921510




      4921510




















          2 Answers
          2






          active

          oldest

          votes


















          1














          pgfcorepathconstruct.code.tex, lines 892–1010:



          % Append an ellipse to the current path.
          %
          % #1 = center
          % #2 = first axis
          % #3 = second axis
          %
          % Example:
          %
          % % Add a circle of radius 3cm around the origin
          % pgfpathellipsepgforiginpgfxy(2,0)pgfxy(0,1)
          %
          % % Draw a non-filled circle of radius 1cm around the point (1,1)
          % pgfpathellipsepgfxy(1,1)pgfxy(1,1)pgfxy(-2,2)
          % pgfstroke

          defpgfpathellipse#1#2#3%
          pgfpointtransformed#1% store center in xc/yc
          pgf@xc=pgf@x%
          pgf@yc=pgf@y%
          pgfpointtransformed#2%
          pgf@xa=pgf@x% store first axis in xa/ya
          pgf@ya=pgf@y%
          advancepgf@xa by-pgf@pt@x%
          advancepgf@ya by-pgf@pt@y%
          pgfpointtransformed#3%
          pgf@xb=pgf@x% store second axis in xb/yb
          pgf@yb=pgf@y%
          advancepgf@xb by-pgf@pt@x%
          advancepgf@yb by-pgf@pt@y%
          %
          advancepgf@xa bypgf@xc%
          advancepgf@ya bypgf@yc%
          pgf@nlt@movetopgf@xapgf@ya%
          %
          pgf@x=0.55228475pgf@xb% first arc
          pgf@y=0.55228475pgf@yb%
          advancepgf@x bypgf@xa%
          advancepgf@y bypgf@ya%
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
          pgf@x=0.55228475pgf@xa%
          pgf@y=0.55228475pgf@ya%
          advancepgf@x bypgf@xb%
          advancepgf@y bypgf@yb%
          %
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          advancepgf@xb bypgf@xc%
          advancepgf@yb bypgf@yc%
          pgf@temp%
          pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
          %
          pgf@xa=-pgf@xa% flip first axis
          pgf@ya=-pgf@ya%
          pgf@x=0.55228475pgf@xa% second arc
          pgf@y=0.55228475pgf@ya%
          advancepgf@x bypgf@xb%
          advancepgf@y bypgf@yb%
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
          pgf@x=0.55228475pgf@xb%
          pgf@y=0.55228475pgf@yb%
          advancepgf@x bypgf@xa%
          advancepgf@y bypgf@ya%
          %
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          advancepgf@xa bypgf@xc%
          advancepgf@ya bypgf@yc%
          pgf@temp%
          pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
          %
          pgf@xb=-pgf@xb% flip second axis
          pgf@yb=-pgf@yb%
          pgf@x=0.55228475pgf@xb% third arc
          pgf@y=0.55228475pgf@yb%
          advancepgf@x bypgf@xa%
          advancepgf@y bypgf@ya%
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
          pgf@x=0.55228475pgf@xa%
          pgf@y=0.55228475pgf@ya%
          advancepgf@x bypgf@xb%
          advancepgf@y bypgf@yb%
          %
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          advancepgf@xb bypgf@xc%
          advancepgf@yb bypgf@yc%
          pgf@temp%
          pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
          %
          pgf@xa=-pgf@xa% flip first axis once more
          pgf@ya=-pgf@ya%
          pgf@x=0.55228475pgf@xa% fourth arc
          pgf@y=0.55228475pgf@ya%
          advancepgf@x bypgf@xb%
          advancepgf@y bypgf@yb%
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
          pgf@x=0.55228475pgf@xb%
          pgf@y=0.55228475pgf@yb%
          advancepgf@x bypgf@xa%
          advancepgf@y bypgf@ya%
          %
          advancepgf@x bypgf@xc%
          advancepgf@y bypgf@yc%
          advancepgf@xa bypgf@xc%
          advancepgf@ya bypgf@yc%
          pgf@temp%
          pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
          %
          pgf@nlt@closepath%
          pgf@nlt@movetopgf@xcpgf@yc%



          Well, just by reading the comments there you will know that the ellipse is drawn by four different curves (each curve is drawn with a pgf@nlt@curveto).



          Note that the same happens with circle.






          share|improve this answer






























            1














            As JouleV points out, the ellipse is drawn in four Bezier curves. If you do not want to look these things up in the code, you can always use show path construction to see how the path is constructed.



            documentclass[tikz,border=3.14mm]standalone
            usetikzlibrarydecorations.pathreplacing
            begindocument
            begintikzpicture[decoration=show path construction, % see p. 634 of the pgfmanual
            moveto code=
            fill [red] (tikzinputsegmentfirst) circle (2pt)
            node [fill=none, below] moveto;,
            lineto code=
            draw [blue,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
            node [above] lineto;
            ,
            curveto code=
            draw [green!75!black,->] (tikzinputsegmentfirst) .. controls
            (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
            ..(tikzinputsegmentlast) node [above] curveto;
            ,
            closepath code=
            draw [orange,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
            node [above] closepath;
            ]
            draw [rotate around=0.:(0.,0.),line width=0.8pt,postaction=decorate] (0.,0.) ellipse (5.cm and 4.cm);
            endtikzpicture
            enddocument


            enter image description here



            This is also true for circles, which is why rotating a circle can modify its bounding box.






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "85"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f489544%2ftikz-pgf-draw-algorithm%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              pgfcorepathconstruct.code.tex, lines 892–1010:



              % Append an ellipse to the current path.
              %
              % #1 = center
              % #2 = first axis
              % #3 = second axis
              %
              % Example:
              %
              % % Add a circle of radius 3cm around the origin
              % pgfpathellipsepgforiginpgfxy(2,0)pgfxy(0,1)
              %
              % % Draw a non-filled circle of radius 1cm around the point (1,1)
              % pgfpathellipsepgfxy(1,1)pgfxy(1,1)pgfxy(-2,2)
              % pgfstroke

              defpgfpathellipse#1#2#3%
              pgfpointtransformed#1% store center in xc/yc
              pgf@xc=pgf@x%
              pgf@yc=pgf@y%
              pgfpointtransformed#2%
              pgf@xa=pgf@x% store first axis in xa/ya
              pgf@ya=pgf@y%
              advancepgf@xa by-pgf@pt@x%
              advancepgf@ya by-pgf@pt@y%
              pgfpointtransformed#3%
              pgf@xb=pgf@x% store second axis in xb/yb
              pgf@yb=pgf@y%
              advancepgf@xb by-pgf@pt@x%
              advancepgf@yb by-pgf@pt@y%
              %
              advancepgf@xa bypgf@xc%
              advancepgf@ya bypgf@yc%
              pgf@nlt@movetopgf@xapgf@ya%
              %
              pgf@x=0.55228475pgf@xb% first arc
              pgf@y=0.55228475pgf@yb%
              advancepgf@x bypgf@xa%
              advancepgf@y bypgf@ya%
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
              pgf@x=0.55228475pgf@xa%
              pgf@y=0.55228475pgf@ya%
              advancepgf@x bypgf@xb%
              advancepgf@y bypgf@yb%
              %
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              advancepgf@xb bypgf@xc%
              advancepgf@yb bypgf@yc%
              pgf@temp%
              pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
              %
              pgf@xa=-pgf@xa% flip first axis
              pgf@ya=-pgf@ya%
              pgf@x=0.55228475pgf@xa% second arc
              pgf@y=0.55228475pgf@ya%
              advancepgf@x bypgf@xb%
              advancepgf@y bypgf@yb%
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
              pgf@x=0.55228475pgf@xb%
              pgf@y=0.55228475pgf@yb%
              advancepgf@x bypgf@xa%
              advancepgf@y bypgf@ya%
              %
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              advancepgf@xa bypgf@xc%
              advancepgf@ya bypgf@yc%
              pgf@temp%
              pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
              %
              pgf@xb=-pgf@xb% flip second axis
              pgf@yb=-pgf@yb%
              pgf@x=0.55228475pgf@xb% third arc
              pgf@y=0.55228475pgf@yb%
              advancepgf@x bypgf@xa%
              advancepgf@y bypgf@ya%
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
              pgf@x=0.55228475pgf@xa%
              pgf@y=0.55228475pgf@ya%
              advancepgf@x bypgf@xb%
              advancepgf@y bypgf@yb%
              %
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              advancepgf@xb bypgf@xc%
              advancepgf@yb bypgf@yc%
              pgf@temp%
              pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
              %
              pgf@xa=-pgf@xa% flip first axis once more
              pgf@ya=-pgf@ya%
              pgf@x=0.55228475pgf@xa% fourth arc
              pgf@y=0.55228475pgf@ya%
              advancepgf@x bypgf@xb%
              advancepgf@y bypgf@yb%
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
              pgf@x=0.55228475pgf@xb%
              pgf@y=0.55228475pgf@yb%
              advancepgf@x bypgf@xa%
              advancepgf@y bypgf@ya%
              %
              advancepgf@x bypgf@xc%
              advancepgf@y bypgf@yc%
              advancepgf@xa bypgf@xc%
              advancepgf@ya bypgf@yc%
              pgf@temp%
              pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
              %
              pgf@nlt@closepath%
              pgf@nlt@movetopgf@xcpgf@yc%



              Well, just by reading the comments there you will know that the ellipse is drawn by four different curves (each curve is drawn with a pgf@nlt@curveto).



              Note that the same happens with circle.






              share|improve this answer



























                1














                pgfcorepathconstruct.code.tex, lines 892–1010:



                % Append an ellipse to the current path.
                %
                % #1 = center
                % #2 = first axis
                % #3 = second axis
                %
                % Example:
                %
                % % Add a circle of radius 3cm around the origin
                % pgfpathellipsepgforiginpgfxy(2,0)pgfxy(0,1)
                %
                % % Draw a non-filled circle of radius 1cm around the point (1,1)
                % pgfpathellipsepgfxy(1,1)pgfxy(1,1)pgfxy(-2,2)
                % pgfstroke

                defpgfpathellipse#1#2#3%
                pgfpointtransformed#1% store center in xc/yc
                pgf@xc=pgf@x%
                pgf@yc=pgf@y%
                pgfpointtransformed#2%
                pgf@xa=pgf@x% store first axis in xa/ya
                pgf@ya=pgf@y%
                advancepgf@xa by-pgf@pt@x%
                advancepgf@ya by-pgf@pt@y%
                pgfpointtransformed#3%
                pgf@xb=pgf@x% store second axis in xb/yb
                pgf@yb=pgf@y%
                advancepgf@xb by-pgf@pt@x%
                advancepgf@yb by-pgf@pt@y%
                %
                advancepgf@xa bypgf@xc%
                advancepgf@ya bypgf@yc%
                pgf@nlt@movetopgf@xapgf@ya%
                %
                pgf@x=0.55228475pgf@xb% first arc
                pgf@y=0.55228475pgf@yb%
                advancepgf@x bypgf@xa%
                advancepgf@y bypgf@ya%
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                pgf@x=0.55228475pgf@xa%
                pgf@y=0.55228475pgf@ya%
                advancepgf@x bypgf@xb%
                advancepgf@y bypgf@yb%
                %
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                advancepgf@xb bypgf@xc%
                advancepgf@yb bypgf@yc%
                pgf@temp%
                pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                %
                pgf@xa=-pgf@xa% flip first axis
                pgf@ya=-pgf@ya%
                pgf@x=0.55228475pgf@xa% second arc
                pgf@y=0.55228475pgf@ya%
                advancepgf@x bypgf@xb%
                advancepgf@y bypgf@yb%
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                pgf@x=0.55228475pgf@xb%
                pgf@y=0.55228475pgf@yb%
                advancepgf@x bypgf@xa%
                advancepgf@y bypgf@ya%
                %
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                advancepgf@xa bypgf@xc%
                advancepgf@ya bypgf@yc%
                pgf@temp%
                pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                %
                pgf@xb=-pgf@xb% flip second axis
                pgf@yb=-pgf@yb%
                pgf@x=0.55228475pgf@xb% third arc
                pgf@y=0.55228475pgf@yb%
                advancepgf@x bypgf@xa%
                advancepgf@y bypgf@ya%
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                pgf@x=0.55228475pgf@xa%
                pgf@y=0.55228475pgf@ya%
                advancepgf@x bypgf@xb%
                advancepgf@y bypgf@yb%
                %
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                advancepgf@xb bypgf@xc%
                advancepgf@yb bypgf@yc%
                pgf@temp%
                pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                %
                pgf@xa=-pgf@xa% flip first axis once more
                pgf@ya=-pgf@ya%
                pgf@x=0.55228475pgf@xa% fourth arc
                pgf@y=0.55228475pgf@ya%
                advancepgf@x bypgf@xb%
                advancepgf@y bypgf@yb%
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                pgf@x=0.55228475pgf@xb%
                pgf@y=0.55228475pgf@yb%
                advancepgf@x bypgf@xa%
                advancepgf@y bypgf@ya%
                %
                advancepgf@x bypgf@xc%
                advancepgf@y bypgf@yc%
                advancepgf@xa bypgf@xc%
                advancepgf@ya bypgf@yc%
                pgf@temp%
                pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                %
                pgf@nlt@closepath%
                pgf@nlt@movetopgf@xcpgf@yc%



                Well, just by reading the comments there you will know that the ellipse is drawn by four different curves (each curve is drawn with a pgf@nlt@curveto).



                Note that the same happens with circle.






                share|improve this answer

























                  1












                  1








                  1







                  pgfcorepathconstruct.code.tex, lines 892–1010:



                  % Append an ellipse to the current path.
                  %
                  % #1 = center
                  % #2 = first axis
                  % #3 = second axis
                  %
                  % Example:
                  %
                  % % Add a circle of radius 3cm around the origin
                  % pgfpathellipsepgforiginpgfxy(2,0)pgfxy(0,1)
                  %
                  % % Draw a non-filled circle of radius 1cm around the point (1,1)
                  % pgfpathellipsepgfxy(1,1)pgfxy(1,1)pgfxy(-2,2)
                  % pgfstroke

                  defpgfpathellipse#1#2#3%
                  pgfpointtransformed#1% store center in xc/yc
                  pgf@xc=pgf@x%
                  pgf@yc=pgf@y%
                  pgfpointtransformed#2%
                  pgf@xa=pgf@x% store first axis in xa/ya
                  pgf@ya=pgf@y%
                  advancepgf@xa by-pgf@pt@x%
                  advancepgf@ya by-pgf@pt@y%
                  pgfpointtransformed#3%
                  pgf@xb=pgf@x% store second axis in xb/yb
                  pgf@yb=pgf@y%
                  advancepgf@xb by-pgf@pt@x%
                  advancepgf@yb by-pgf@pt@y%
                  %
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@nlt@movetopgf@xapgf@ya%
                  %
                  pgf@x=0.55228475pgf@xb% first arc
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xa%
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xb bypgf@xc%
                  advancepgf@yb bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                  %
                  pgf@xa=-pgf@xa% flip first axis
                  pgf@ya=-pgf@ya%
                  pgf@x=0.55228475pgf@xa% second arc
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xb%
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                  %
                  pgf@xb=-pgf@xb% flip second axis
                  pgf@yb=-pgf@yb%
                  pgf@x=0.55228475pgf@xb% third arc
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xa%
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xb bypgf@xc%
                  advancepgf@yb bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                  %
                  pgf@xa=-pgf@xa% flip first axis once more
                  pgf@ya=-pgf@ya%
                  pgf@x=0.55228475pgf@xa% fourth arc
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xb%
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                  %
                  pgf@nlt@closepath%
                  pgf@nlt@movetopgf@xcpgf@yc%



                  Well, just by reading the comments there you will know that the ellipse is drawn by four different curves (each curve is drawn with a pgf@nlt@curveto).



                  Note that the same happens with circle.






                  share|improve this answer













                  pgfcorepathconstruct.code.tex, lines 892–1010:



                  % Append an ellipse to the current path.
                  %
                  % #1 = center
                  % #2 = first axis
                  % #3 = second axis
                  %
                  % Example:
                  %
                  % % Add a circle of radius 3cm around the origin
                  % pgfpathellipsepgforiginpgfxy(2,0)pgfxy(0,1)
                  %
                  % % Draw a non-filled circle of radius 1cm around the point (1,1)
                  % pgfpathellipsepgfxy(1,1)pgfxy(1,1)pgfxy(-2,2)
                  % pgfstroke

                  defpgfpathellipse#1#2#3%
                  pgfpointtransformed#1% store center in xc/yc
                  pgf@xc=pgf@x%
                  pgf@yc=pgf@y%
                  pgfpointtransformed#2%
                  pgf@xa=pgf@x% store first axis in xa/ya
                  pgf@ya=pgf@y%
                  advancepgf@xa by-pgf@pt@x%
                  advancepgf@ya by-pgf@pt@y%
                  pgfpointtransformed#3%
                  pgf@xb=pgf@x% store second axis in xb/yb
                  pgf@yb=pgf@y%
                  advancepgf@xb by-pgf@pt@x%
                  advancepgf@yb by-pgf@pt@y%
                  %
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@nlt@movetopgf@xapgf@ya%
                  %
                  pgf@x=0.55228475pgf@xb% first arc
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xa%
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xb bypgf@xc%
                  advancepgf@yb bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                  %
                  pgf@xa=-pgf@xa% flip first axis
                  pgf@ya=-pgf@ya%
                  pgf@x=0.55228475pgf@xa% second arc
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xb%
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                  %
                  pgf@xb=-pgf@xb% flip second axis
                  pgf@yb=-pgf@yb%
                  pgf@x=0.55228475pgf@xb% third arc
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xa%
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xb bypgf@xc%
                  advancepgf@yb bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xbpgf@yb%
                  %
                  pgf@xa=-pgf@xa% flip first axis once more
                  pgf@ya=-pgf@ya%
                  pgf@x=0.55228475pgf@xa% fourth arc
                  pgf@y=0.55228475pgf@ya%
                  advancepgf@x bypgf@xb%
                  advancepgf@y bypgf@yb%
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  edefpgf@temppgf@xcthepgf@xpgf@ycthepgf@y%
                  pgf@x=0.55228475pgf@xb%
                  pgf@y=0.55228475pgf@yb%
                  advancepgf@x bypgf@xa%
                  advancepgf@y bypgf@ya%
                  %
                  advancepgf@x bypgf@xc%
                  advancepgf@y bypgf@yc%
                  advancepgf@xa bypgf@xc%
                  advancepgf@ya bypgf@yc%
                  pgf@temp%
                  pgf@nlt@curvetopgf@xcpgf@ycpgf@xpgf@ypgf@xapgf@ya%
                  %
                  pgf@nlt@closepath%
                  pgf@nlt@movetopgf@xcpgf@yc%



                  Well, just by reading the comments there you will know that the ellipse is drawn by four different curves (each curve is drawn with a pgf@nlt@curveto).



                  Note that the same happens with circle.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 43 mins ago









                  JouleVJouleV

                  16.4k22668




                  16.4k22668





















                      1














                      As JouleV points out, the ellipse is drawn in four Bezier curves. If you do not want to look these things up in the code, you can always use show path construction to see how the path is constructed.



                      documentclass[tikz,border=3.14mm]standalone
                      usetikzlibrarydecorations.pathreplacing
                      begindocument
                      begintikzpicture[decoration=show path construction, % see p. 634 of the pgfmanual
                      moveto code=
                      fill [red] (tikzinputsegmentfirst) circle (2pt)
                      node [fill=none, below] moveto;,
                      lineto code=
                      draw [blue,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                      node [above] lineto;
                      ,
                      curveto code=
                      draw [green!75!black,->] (tikzinputsegmentfirst) .. controls
                      (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                      ..(tikzinputsegmentlast) node [above] curveto;
                      ,
                      closepath code=
                      draw [orange,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                      node [above] closepath;
                      ]
                      draw [rotate around=0.:(0.,0.),line width=0.8pt,postaction=decorate] (0.,0.) ellipse (5.cm and 4.cm);
                      endtikzpicture
                      enddocument


                      enter image description here



                      This is also true for circles, which is why rotating a circle can modify its bounding box.






                      share|improve this answer



























                        1














                        As JouleV points out, the ellipse is drawn in four Bezier curves. If you do not want to look these things up in the code, you can always use show path construction to see how the path is constructed.



                        documentclass[tikz,border=3.14mm]standalone
                        usetikzlibrarydecorations.pathreplacing
                        begindocument
                        begintikzpicture[decoration=show path construction, % see p. 634 of the pgfmanual
                        moveto code=
                        fill [red] (tikzinputsegmentfirst) circle (2pt)
                        node [fill=none, below] moveto;,
                        lineto code=
                        draw [blue,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                        node [above] lineto;
                        ,
                        curveto code=
                        draw [green!75!black,->] (tikzinputsegmentfirst) .. controls
                        (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                        ..(tikzinputsegmentlast) node [above] curveto;
                        ,
                        closepath code=
                        draw [orange,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                        node [above] closepath;
                        ]
                        draw [rotate around=0.:(0.,0.),line width=0.8pt,postaction=decorate] (0.,0.) ellipse (5.cm and 4.cm);
                        endtikzpicture
                        enddocument


                        enter image description here



                        This is also true for circles, which is why rotating a circle can modify its bounding box.






                        share|improve this answer

























                          1












                          1








                          1







                          As JouleV points out, the ellipse is drawn in four Bezier curves. If you do not want to look these things up in the code, you can always use show path construction to see how the path is constructed.



                          documentclass[tikz,border=3.14mm]standalone
                          usetikzlibrarydecorations.pathreplacing
                          begindocument
                          begintikzpicture[decoration=show path construction, % see p. 634 of the pgfmanual
                          moveto code=
                          fill [red] (tikzinputsegmentfirst) circle (2pt)
                          node [fill=none, below] moveto;,
                          lineto code=
                          draw [blue,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                          node [above] lineto;
                          ,
                          curveto code=
                          draw [green!75!black,->] (tikzinputsegmentfirst) .. controls
                          (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                          ..(tikzinputsegmentlast) node [above] curveto;
                          ,
                          closepath code=
                          draw [orange,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                          node [above] closepath;
                          ]
                          draw [rotate around=0.:(0.,0.),line width=0.8pt,postaction=decorate] (0.,0.) ellipse (5.cm and 4.cm);
                          endtikzpicture
                          enddocument


                          enter image description here



                          This is also true for circles, which is why rotating a circle can modify its bounding box.






                          share|improve this answer













                          As JouleV points out, the ellipse is drawn in four Bezier curves. If you do not want to look these things up in the code, you can always use show path construction to see how the path is constructed.



                          documentclass[tikz,border=3.14mm]standalone
                          usetikzlibrarydecorations.pathreplacing
                          begindocument
                          begintikzpicture[decoration=show path construction, % see p. 634 of the pgfmanual
                          moveto code=
                          fill [red] (tikzinputsegmentfirst) circle (2pt)
                          node [fill=none, below] moveto;,
                          lineto code=
                          draw [blue,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                          node [above] lineto;
                          ,
                          curveto code=
                          draw [green!75!black,->] (tikzinputsegmentfirst) .. controls
                          (tikzinputsegmentsupporta) and (tikzinputsegmentsupportb)
                          ..(tikzinputsegmentlast) node [above] curveto;
                          ,
                          closepath code=
                          draw [orange,->] (tikzinputsegmentfirst) -- (tikzinputsegmentlast)
                          node [above] closepath;
                          ]
                          draw [rotate around=0.:(0.,0.),line width=0.8pt,postaction=decorate] (0.,0.) ellipse (5.cm and 4.cm);
                          endtikzpicture
                          enddocument


                          enter image description here



                          This is also true for circles, which is why rotating a circle can modify its bounding box.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 40 mins ago









                          marmotmarmot

                          124k6161307




                          124k6161307



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f489544%2ftikz-pgf-draw-algorithm%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Log på Navigationsmenu

                              Creating second map without labels using QGIS?How to lock map labels for inset map in Print Composer?How to Force the Showing of Labels of a Vector File in QGISQGIS Valmiera, Labels only show for part of polygonsRemoving duplicate point labels in QGISLabeling every feature using QGIS?Show labels for point features outside map canvasAbbreviate Road Labels in QGIS only when requiredExporting map from composer in QGIS - text labels have moved in output?How to make sure labels in qgis turn up in layout map?Writing label expression with ArcMap and If then Statement?

                              Nuuk Indholdsfortegnelse Etyomologi | Historie | Geografi | Transport og infrastruktur | Politik og administration | Uddannelsesinstitutioner | Kultur | Venskabsbyer | Noter | Eksterne henvisninger | Se også | Navigationsmenuwww.sermersooq.gl64°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.75064°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.750DMI - KlimanormalerSalmonsen, s. 850Grønlands Naturinstitut undersøger rensdyr i Akia og Maniitsoq foråret 2008Grønlands NaturinstitutNy vej til Qinngorput indviet i dagAntallet af biler i Nuuk må begrænsesNy taxacentral mødt med demonstrationKøreplan. Rute 1, 2 og 3SnescootersporNuukNord er for storSkoler i Kommuneqarfik SermersooqAtuarfik Samuel KleinschmidtKangillinguit AtuarfiatNuussuup AtuarfiaNuuk Internationale FriskoleIlinniarfissuaq, Grønlands SeminariumLedelseÅrsberetning for 2008Kunst og arkitekturÅrsberetning for 2008Julie om naturenNuuk KunstmuseumSilamiutGrønlands Nationalmuseum og ArkivStatistisk ÅrbogGrønlands LandsbibliotekStore koncerter på stribeVandhund nummer 1.000.000Kommuneqarfik Sermersooq – MalikForsidenVenskabsbyerLyngby-Taarbæk i GrønlandArctic Business NetworkWinter Cities 2008 i NuukDagligt opdaterede satellitbilleder fra NuukområdetKommuneqarfik Sermersooqs hjemmesideTurist i NuukGrønlands Statistiks databankGrønlands Hjemmestyres valgresultaterrrWorldCat124325457671310-5