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

Splitting polygons and dividing attribute value proportionally using ArcGIS Pro?

Convert a huge txt-file into a dataset

When does WordPress.org notify sites of new version?

My parents are Afghan

Why did not Iron man upload his complete memory onto a computer?

Does restarting the SQL Services (on the machine) clear the server cache (for things like query plans and statistics)?

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

Texture vs. Material vs. Shader

How do I minimise waste on a flight?

Why is there a cap on 401k contributions?

Many one decreasing function?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

And now you see it

call() a function within its own context

What did Varys actually mean?

Are modes in jazz primarily a melody thing?

Good introductory book to type theory?

Picking a theme as a discovery writer

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.

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

Can anyone identify this unknown 1988 PC card from The Palantir Corporation?

Gift for mentor after his thesis defense?

If quadruped mammals evolve to become bipedal will their breast or nipple change position?

Convert Numbers To Emoji Math



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













4















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


























    4















    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
























      4












      4








      4








      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

      4971510




      4971510




















          2 Answers
          2






          active

          oldest

          votes


















          2














          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






























            2














            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









              2














              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



























                2














                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

























                  2












                  2








                  2







                  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





















                      2














                      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



























                        2














                        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

























                          2












                          2








                          2







                          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

                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                              199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單