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

Is it safe to keep the GPU on 100% utilization for a very long time?

Test whether a string is in a list with variable

How could a humanoid creature completely form within the span of 24 hours?

My large rocket is still flipping over

In the figure, a quarter circle, a semicircle and a circle are mutually tangent inside a square of side length 2. Find the radius of the circle.

Select list elements based on other list

Does this website provide consistent translation into Wookiee?

Is throwing dice a stochastic or a deterministic process?

Displaying an Estimated Execution Plan generates CXPACKET, PAGELATCH_SH, and LATCH_EX [ACCESS_METHODS_DATASET_PARENT] waits

Convert Numbers To Emoji Math

Correct verb with there

Texture vs. Material vs. Shader

Which "exotic salt" can lower water's freezing point by 70 °C?

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

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

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

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

How to get the decimal part of a number in apex

Splitting polygons and dividing attribute value proportionally using ArcGIS Pro?

Where do 5 or more U.S. counties meet in a single point?

Would a legitimized Baratheon have the best claim for the Iron Throne?

A problem with Hebrew and English underlined text

Why were the rules for Proliferate changed?

No game no life what were the two siblings referencing in EP 5



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













5















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


























    5















    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
























      5












      5








      5








      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 1 hour ago









      147pm147pm

      5021510




      5021510




















          2 Answers
          2






          active

          oldest

          votes


















          3














          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






























            3














            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









              3














              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



























                3














                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

























                  3












                  3








                  3







                  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 1 hour ago









                  JouleVJouleV

                  16.4k22668




                  16.4k22668





















                      3














                      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



























                        3














                        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

























                          3












                          3








                          3







                          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 1 hour ago









                          marmotmarmot

                          125k6161307




                          125k6161307



























                              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

                              Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                              The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                              19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу