How to anchor the origin (0,0,0) to the center of multiple generated images in tikz?TikZ: Cropping the...

Password Hashing Security Using Scrypt & Argon2

When an electron changes its spin, or any other intrinsic property, is it still the same electron?

What exactly is a "murder hobo"?

Why AI became applicable only after Nvidia's chips were available?

When I press the space bar it deletes the letters in front of it

An integral that needs subtitution to be solved.

What was this character's plan?

How to evaluate the performance of open source solver?

Would a Nikon FG 20 film SLR camera take pictures without batteries?

What's it called when the bad guy gets eaten?

Need a non-volatile memory IC with near unlimited read/write operations capability

Performance issue in code for reading line and testing for palindrome

How was the Shuttle loaded and unloaded from its carrier aircraft?

Party going through airport security at separate times?

Hail hit my roof. Do I need to replace it?

What factors could lead to bishops establishing monastic armies?

Moving millions of files to a different directory with specfic name patterns

How to find the positions of replaced elements in a list

How to properly translate the key phrase of Erdoğan's 2016 letter to Putin, "kusura bakmasınlar," to Russian

Why did Old English lose both thorn and eth?

US citizen traveling with Peruvian passport

Can a landlord force all residents to use the landlord's in-house debit card accounts?

VHF 50 Ω Antenna Over 75 Ω TV Coax

Is it okay to use open source code to do an interview task?



How to anchor the origin (0,0,0) to the center of multiple generated images in tikz?


TikZ: Cropping the Bounding BoxAlign edges with anchor other than centerHow to define the default vertical distance between nodes?Understanding TikZ border anchorEdge anchor in tikztikz and pgfdeclareshape why the text is not at the center anchor?small multiple images moving toward each other in beamertikz anchor unexpectedtikz-cd nested tikzpicture wrong center anchortikz: show 0 at the axis origin






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















I have the following file to generate an animation with a separate file



documentclass[tikz, border=1cm]{standalone}

usepackage{tkz-euclide}
usetkzobj{all}

begin{document}

foreach vari in {0,5,10,15,...,360}
{

begin{tikzpicture}
[
scale=.5,
x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
rotate around z=vari
]

% coordinates

coordinate (A) at (3,-3,0);
coordinate (B) at (3,3,0);
coordinate (C) at (-3,3,0);
coordinate (D) at (-3,-3,0);
coordinate (E) at (3,-3,3);
coordinate (F) at (3,3,3);
coordinate (G) at (-3,3,3);
coordinate (H) at (-3,-3,3);

tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

% Axes 3d

draw[->,>=stealth] (3,0,0) -- (5,0,0);
draw[->,>=stealth] (0,3,0) -- (0,5,0);
draw[dashed] (0,0,0) -- (0,0,4);
draw[dashed] (0,0,0) -- (0,3,0);
draw[dashed] (0,0,0) -- (3,0,0);

tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
tkzLabelPoints[above](E,F,G,H)
tkzLabelPoints[below](A,B,C,D)

draw[->,>=stealth] (0,0,4) -- (0,0,7);
end{tikzpicture}
}
end{document}


but my problem is that the point (0,0,0) changes place during rotation and I would like to have it in a single place throughout the entire animation. Is there a way to anchor it?



Thank you.










share|improve this question





























    2















    I have the following file to generate an animation with a separate file



    documentclass[tikz, border=1cm]{standalone}

    usepackage{tkz-euclide}
    usetkzobj{all}

    begin{document}

    foreach vari in {0,5,10,15,...,360}
    {

    begin{tikzpicture}
    [
    scale=.5,
    x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
    rotate around z=vari
    ]

    % coordinates

    coordinate (A) at (3,-3,0);
    coordinate (B) at (3,3,0);
    coordinate (C) at (-3,3,0);
    coordinate (D) at (-3,-3,0);
    coordinate (E) at (3,-3,3);
    coordinate (F) at (3,3,3);
    coordinate (G) at (-3,3,3);
    coordinate (H) at (-3,-3,3);

    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

    % Axes 3d

    draw[->,>=stealth] (3,0,0) -- (5,0,0);
    draw[->,>=stealth] (0,3,0) -- (0,5,0);
    draw[dashed] (0,0,0) -- (0,0,4);
    draw[dashed] (0,0,0) -- (0,3,0);
    draw[dashed] (0,0,0) -- (3,0,0);

    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
    tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

    tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
    tkzLabelPoints[above](E,F,G,H)
    tkzLabelPoints[below](A,B,C,D)

    draw[->,>=stealth] (0,0,4) -- (0,0,7);
    end{tikzpicture}
    }
    end{document}


    but my problem is that the point (0,0,0) changes place during rotation and I would like to have it in a single place throughout the entire animation. Is there a way to anchor it?



    Thank you.










    share|improve this question

























      2












      2








      2








      I have the following file to generate an animation with a separate file



      documentclass[tikz, border=1cm]{standalone}

      usepackage{tkz-euclide}
      usetkzobj{all}

      begin{document}

      foreach vari in {0,5,10,15,...,360}
      {

      begin{tikzpicture}
      [
      scale=.5,
      x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
      rotate around z=vari
      ]

      % coordinates

      coordinate (A) at (3,-3,0);
      coordinate (B) at (3,3,0);
      coordinate (C) at (-3,3,0);
      coordinate (D) at (-3,-3,0);
      coordinate (E) at (3,-3,3);
      coordinate (F) at (3,3,3);
      coordinate (G) at (-3,3,3);
      coordinate (H) at (-3,-3,3);

      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

      % Axes 3d

      draw[->,>=stealth] (3,0,0) -- (5,0,0);
      draw[->,>=stealth] (0,3,0) -- (0,5,0);
      draw[dashed] (0,0,0) -- (0,0,4);
      draw[dashed] (0,0,0) -- (0,3,0);
      draw[dashed] (0,0,0) -- (3,0,0);

      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

      tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
      tkzLabelPoints[above](E,F,G,H)
      tkzLabelPoints[below](A,B,C,D)

      draw[->,>=stealth] (0,0,4) -- (0,0,7);
      end{tikzpicture}
      }
      end{document}


      but my problem is that the point (0,0,0) changes place during rotation and I would like to have it in a single place throughout the entire animation. Is there a way to anchor it?



      Thank you.










      share|improve this question














      I have the following file to generate an animation with a separate file



      documentclass[tikz, border=1cm]{standalone}

      usepackage{tkz-euclide}
      usetkzobj{all}

      begin{document}

      foreach vari in {0,5,10,15,...,360}
      {

      begin{tikzpicture}
      [
      scale=.5,
      x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
      rotate around z=vari
      ]

      % coordinates

      coordinate (A) at (3,-3,0);
      coordinate (B) at (3,3,0);
      coordinate (C) at (-3,3,0);
      coordinate (D) at (-3,-3,0);
      coordinate (E) at (3,-3,3);
      coordinate (F) at (3,3,3);
      coordinate (G) at (-3,3,3);
      coordinate (H) at (-3,-3,3);

      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

      % Axes 3d

      draw[->,>=stealth] (3,0,0) -- (5,0,0);
      draw[->,>=stealth] (0,3,0) -- (0,5,0);
      draw[dashed] (0,0,0) -- (0,0,4);
      draw[dashed] (0,0,0) -- (0,3,0);
      draw[dashed] (0,0,0) -- (3,0,0);

      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
      tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

      tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
      tkzLabelPoints[above](E,F,G,H)
      tkzLabelPoints[below](A,B,C,D)

      draw[->,>=stealth] (0,0,4) -- (0,0,7);
      end{tikzpicture}
      }
      end{document}


      but my problem is that the point (0,0,0) changes place during rotation and I would like to have it in a single place throughout the entire animation. Is there a way to anchor it?



      Thank you.







      tikz-pgf animate






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      Concept7Concept7

      1237 bronze badges




      1237 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          3














          It is not the point (0,0,0) that changes but the bounding box. To prevent this from happening, you can set a bounding box yourself, e.g. by saying



            path[use as bounding box] (-4,-1.45) rectangle (4,4);


          This yields



          documentclass[tikz, border=1cm]{standalone}

          usepackage{tkz-euclide}
          usetkzobj{all}

          begin{document}

          foreach vari in {0,5,10,15,...,360}
          {

          begin{tikzpicture}
          path[use as bounding box] (-4,-1.45) rectangle (4,4);
          begin{scope}
          [
          scale=.5,
          x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
          rotate around z=vari
          ]

          % coordinates
          coordinate (A) at (3,-3,0);
          coordinate (B) at (3,3,0);
          coordinate (C) at (-3,3,0);
          coordinate (D) at (-3,-3,0);
          coordinate (E) at (3,-3,3);
          coordinate (F) at (3,3,3);
          coordinate (G) at (-3,3,3);
          coordinate (H) at (-3,-3,3);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

          % Axes 3d

          draw[->,>=stealth] (3,0,0) -- (5,0,0);
          draw[->,>=stealth] (0,3,0) -- (0,5,0);
          draw[dashed] (0,0,0) -- (0,0,4);
          draw[dashed] (0,0,0) -- (0,3,0);
          draw[dashed] (0,0,0) -- (3,0,0);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

          tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
          tkzLabelPoints[above](E,F,G,H)
          tkzLabelPoints[below](A,B,C,D)

          draw[->,>=stealth] (0,0,4) -- (0,0,7);
          end{scope}
          end{tikzpicture}
          }
          end{document}


          enter image description here



          However, I would recommend tikz-3dplot for that. It allows you to do orthographic projections, and makes it more easy to distinguish hidden from foreground faces. I also use [a routine to determine the minimal bounding box that fits all frames.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage{tikz-3dplot}
          newcounter{x}
          newcounter{y}
          newcounter{z}
          tikzset{plane/.style n args={3}{insert path={%
          #1 -- ++ #2 -- ++ #3 -- ++ ($-1*#2$) -- cycle}},
          xy plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}},
          xz plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          yz plane/.style={plane={#1}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          get projections/.style={insert path={%
          let p1=(1,0,0),p2=(0,1,0) in
          [/utils/exec={pgfmathtruncatemacro{xproj}{sign(x1)}xdefxproj{xproj}
          pgfmathtruncatemacro{yproj}{sign(x2)}xdefyproj{yproj}
          pgfmathtruncatemacro{zproj}{sign(cos(tdplotmaintheta))}xdefzproj{zproj}}]}},
          pics/3d block/.style={code={
          tikzset{3d block/.cd,#1}
          path[get projections];
          ifnumzproj=-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumzproj>-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          }},
          3d block/.cd,
          xy face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          xz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          yz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          every face/.style={draw,very thick},
          x length/.initial=1,
          y length/.initial=1,
          z length/.initial=1,
          /tikz/retrieve bounding box/.style={insert path={
          let p1=(current bounding box.south west),
          p2=(current bounding box.north east)
          in pgfextra{%
          pgfmathsetmacro{xmin}{min(x1,xmin)}
          pgfmathsetmacro{xmax}{max(x2,xmax)}
          pgfmathsetmacro{ymin}{min(y1,ymin)}
          pgfmathsetmacro{ymax}{max(y2,ymax)}
          xdefxmin{xmin pt}
          xdefxmax{xmax pt}
          xdefymin{ymin pt}
          xdefymax{ymax pt}
          %typeout{xmin,xmax,ymin,ymax}
          }}}}
          pgfmathsetmacro{xmin}{0}
          pgfmathsetmacro{xmax}{0}
          pgfmathsetmacro{ymin}{0}
          pgfmathsetmacro{ymax}{0}
          begin{document}
          foreach vari in {0,5,10,15,...,360}
          {tdplotsetmaincoords{70}{vari} % the first argument cannot be larger than 90
          begin{tikzpicture}[line join=round,tdplot_main_coords,>=stealth]
          ifdefinedfigbbrelax
          path figbb;
          fi
          coordinate (A) at (3,-3,-1.5);
          coordinate (B) at (3,3,-1.5);
          coordinate (C) at (-3,3,-1.5);
          coordinate (D) at (-3,-3,-1.5);
          coordinate (E) at (3,-3,1.5);
          coordinate (F) at (3,3,1.5);
          coordinate (G) at (-3,3,1.5);
          coordinate (H) at (-3,-3,1.5);
          foreach X in {A,B,C,D}
          {path (X) node[below]{X};}
          draw[dashed] (3,0,-1.5) -- (0,0,-1.5) -- (0,3,-1.5)
          (0,0,-1.5) -- (0,0,1.5);
          draw[thick,->] (3,0,-1.5) -- (5,0,-1.5);
          draw[thick,->] (0,3,-1.5) -- (0,5,-1.5);
          pic{3d block={x length=6,y length=6,z length=3}};
          draw[thick,->] (0,0,1.5) -- (0,0,4);
          foreach X in {E,F,G,H}
          {path (X) node[above]{X};}
          path[retrieve bounding box];
          end{tikzpicture}}
          makeatletter
          edeffigbb{(xmin,ymin) rectangle (xmax,ymax)}
          immediatewrite@mainaux{xdefstringfigbb{figbb}relax}
          makeatother
          end{document}


          enter image description here






          share|improve this answer


























          • Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

            – Concept7
            8 hours ago






          • 2





            @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

            – marmot
            8 hours ago






          • 1





            @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

            – marmot
            7 hours ago














          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%2f499021%2fhow-to-anchor-the-origin-0-0-0-to-the-center-of-multiple-generated-images-in-t%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          It is not the point (0,0,0) that changes but the bounding box. To prevent this from happening, you can set a bounding box yourself, e.g. by saying



            path[use as bounding box] (-4,-1.45) rectangle (4,4);


          This yields



          documentclass[tikz, border=1cm]{standalone}

          usepackage{tkz-euclide}
          usetkzobj{all}

          begin{document}

          foreach vari in {0,5,10,15,...,360}
          {

          begin{tikzpicture}
          path[use as bounding box] (-4,-1.45) rectangle (4,4);
          begin{scope}
          [
          scale=.5,
          x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
          rotate around z=vari
          ]

          % coordinates
          coordinate (A) at (3,-3,0);
          coordinate (B) at (3,3,0);
          coordinate (C) at (-3,3,0);
          coordinate (D) at (-3,-3,0);
          coordinate (E) at (3,-3,3);
          coordinate (F) at (3,3,3);
          coordinate (G) at (-3,3,3);
          coordinate (H) at (-3,-3,3);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

          % Axes 3d

          draw[->,>=stealth] (3,0,0) -- (5,0,0);
          draw[->,>=stealth] (0,3,0) -- (0,5,0);
          draw[dashed] (0,0,0) -- (0,0,4);
          draw[dashed] (0,0,0) -- (0,3,0);
          draw[dashed] (0,0,0) -- (3,0,0);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

          tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
          tkzLabelPoints[above](E,F,G,H)
          tkzLabelPoints[below](A,B,C,D)

          draw[->,>=stealth] (0,0,4) -- (0,0,7);
          end{scope}
          end{tikzpicture}
          }
          end{document}


          enter image description here



          However, I would recommend tikz-3dplot for that. It allows you to do orthographic projections, and makes it more easy to distinguish hidden from foreground faces. I also use [a routine to determine the minimal bounding box that fits all frames.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage{tikz-3dplot}
          newcounter{x}
          newcounter{y}
          newcounter{z}
          tikzset{plane/.style n args={3}{insert path={%
          #1 -- ++ #2 -- ++ #3 -- ++ ($-1*#2$) -- cycle}},
          xy plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}},
          xz plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          yz plane/.style={plane={#1}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          get projections/.style={insert path={%
          let p1=(1,0,0),p2=(0,1,0) in
          [/utils/exec={pgfmathtruncatemacro{xproj}{sign(x1)}xdefxproj{xproj}
          pgfmathtruncatemacro{yproj}{sign(x2)}xdefyproj{yproj}
          pgfmathtruncatemacro{zproj}{sign(cos(tdplotmaintheta))}xdefzproj{zproj}}]}},
          pics/3d block/.style={code={
          tikzset{3d block/.cd,#1}
          path[get projections];
          ifnumzproj=-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumzproj>-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          }},
          3d block/.cd,
          xy face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          xz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          yz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          every face/.style={draw,very thick},
          x length/.initial=1,
          y length/.initial=1,
          z length/.initial=1,
          /tikz/retrieve bounding box/.style={insert path={
          let p1=(current bounding box.south west),
          p2=(current bounding box.north east)
          in pgfextra{%
          pgfmathsetmacro{xmin}{min(x1,xmin)}
          pgfmathsetmacro{xmax}{max(x2,xmax)}
          pgfmathsetmacro{ymin}{min(y1,ymin)}
          pgfmathsetmacro{ymax}{max(y2,ymax)}
          xdefxmin{xmin pt}
          xdefxmax{xmax pt}
          xdefymin{ymin pt}
          xdefymax{ymax pt}
          %typeout{xmin,xmax,ymin,ymax}
          }}}}
          pgfmathsetmacro{xmin}{0}
          pgfmathsetmacro{xmax}{0}
          pgfmathsetmacro{ymin}{0}
          pgfmathsetmacro{ymax}{0}
          begin{document}
          foreach vari in {0,5,10,15,...,360}
          {tdplotsetmaincoords{70}{vari} % the first argument cannot be larger than 90
          begin{tikzpicture}[line join=round,tdplot_main_coords,>=stealth]
          ifdefinedfigbbrelax
          path figbb;
          fi
          coordinate (A) at (3,-3,-1.5);
          coordinate (B) at (3,3,-1.5);
          coordinate (C) at (-3,3,-1.5);
          coordinate (D) at (-3,-3,-1.5);
          coordinate (E) at (3,-3,1.5);
          coordinate (F) at (3,3,1.5);
          coordinate (G) at (-3,3,1.5);
          coordinate (H) at (-3,-3,1.5);
          foreach X in {A,B,C,D}
          {path (X) node[below]{X};}
          draw[dashed] (3,0,-1.5) -- (0,0,-1.5) -- (0,3,-1.5)
          (0,0,-1.5) -- (0,0,1.5);
          draw[thick,->] (3,0,-1.5) -- (5,0,-1.5);
          draw[thick,->] (0,3,-1.5) -- (0,5,-1.5);
          pic{3d block={x length=6,y length=6,z length=3}};
          draw[thick,->] (0,0,1.5) -- (0,0,4);
          foreach X in {E,F,G,H}
          {path (X) node[above]{X};}
          path[retrieve bounding box];
          end{tikzpicture}}
          makeatletter
          edeffigbb{(xmin,ymin) rectangle (xmax,ymax)}
          immediatewrite@mainaux{xdefstringfigbb{figbb}relax}
          makeatother
          end{document}


          enter image description here






          share|improve this answer


























          • Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

            – Concept7
            8 hours ago






          • 2





            @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

            – marmot
            8 hours ago






          • 1





            @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

            – marmot
            7 hours ago
















          3














          It is not the point (0,0,0) that changes but the bounding box. To prevent this from happening, you can set a bounding box yourself, e.g. by saying



            path[use as bounding box] (-4,-1.45) rectangle (4,4);


          This yields



          documentclass[tikz, border=1cm]{standalone}

          usepackage{tkz-euclide}
          usetkzobj{all}

          begin{document}

          foreach vari in {0,5,10,15,...,360}
          {

          begin{tikzpicture}
          path[use as bounding box] (-4,-1.45) rectangle (4,4);
          begin{scope}
          [
          scale=.5,
          x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
          rotate around z=vari
          ]

          % coordinates
          coordinate (A) at (3,-3,0);
          coordinate (B) at (3,3,0);
          coordinate (C) at (-3,3,0);
          coordinate (D) at (-3,-3,0);
          coordinate (E) at (3,-3,3);
          coordinate (F) at (3,3,3);
          coordinate (G) at (-3,3,3);
          coordinate (H) at (-3,-3,3);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

          % Axes 3d

          draw[->,>=stealth] (3,0,0) -- (5,0,0);
          draw[->,>=stealth] (0,3,0) -- (0,5,0);
          draw[dashed] (0,0,0) -- (0,0,4);
          draw[dashed] (0,0,0) -- (0,3,0);
          draw[dashed] (0,0,0) -- (3,0,0);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

          tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
          tkzLabelPoints[above](E,F,G,H)
          tkzLabelPoints[below](A,B,C,D)

          draw[->,>=stealth] (0,0,4) -- (0,0,7);
          end{scope}
          end{tikzpicture}
          }
          end{document}


          enter image description here



          However, I would recommend tikz-3dplot for that. It allows you to do orthographic projections, and makes it more easy to distinguish hidden from foreground faces. I also use [a routine to determine the minimal bounding box that fits all frames.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage{tikz-3dplot}
          newcounter{x}
          newcounter{y}
          newcounter{z}
          tikzset{plane/.style n args={3}{insert path={%
          #1 -- ++ #2 -- ++ #3 -- ++ ($-1*#2$) -- cycle}},
          xy plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}},
          xz plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          yz plane/.style={plane={#1}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          get projections/.style={insert path={%
          let p1=(1,0,0),p2=(0,1,0) in
          [/utils/exec={pgfmathtruncatemacro{xproj}{sign(x1)}xdefxproj{xproj}
          pgfmathtruncatemacro{yproj}{sign(x2)}xdefyproj{yproj}
          pgfmathtruncatemacro{zproj}{sign(cos(tdplotmaintheta))}xdefzproj{zproj}}]}},
          pics/3d block/.style={code={
          tikzset{3d block/.cd,#1}
          path[get projections];
          ifnumzproj=-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumzproj>-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          }},
          3d block/.cd,
          xy face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          xz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          yz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          every face/.style={draw,very thick},
          x length/.initial=1,
          y length/.initial=1,
          z length/.initial=1,
          /tikz/retrieve bounding box/.style={insert path={
          let p1=(current bounding box.south west),
          p2=(current bounding box.north east)
          in pgfextra{%
          pgfmathsetmacro{xmin}{min(x1,xmin)}
          pgfmathsetmacro{xmax}{max(x2,xmax)}
          pgfmathsetmacro{ymin}{min(y1,ymin)}
          pgfmathsetmacro{ymax}{max(y2,ymax)}
          xdefxmin{xmin pt}
          xdefxmax{xmax pt}
          xdefymin{ymin pt}
          xdefymax{ymax pt}
          %typeout{xmin,xmax,ymin,ymax}
          }}}}
          pgfmathsetmacro{xmin}{0}
          pgfmathsetmacro{xmax}{0}
          pgfmathsetmacro{ymin}{0}
          pgfmathsetmacro{ymax}{0}
          begin{document}
          foreach vari in {0,5,10,15,...,360}
          {tdplotsetmaincoords{70}{vari} % the first argument cannot be larger than 90
          begin{tikzpicture}[line join=round,tdplot_main_coords,>=stealth]
          ifdefinedfigbbrelax
          path figbb;
          fi
          coordinate (A) at (3,-3,-1.5);
          coordinate (B) at (3,3,-1.5);
          coordinate (C) at (-3,3,-1.5);
          coordinate (D) at (-3,-3,-1.5);
          coordinate (E) at (3,-3,1.5);
          coordinate (F) at (3,3,1.5);
          coordinate (G) at (-3,3,1.5);
          coordinate (H) at (-3,-3,1.5);
          foreach X in {A,B,C,D}
          {path (X) node[below]{X};}
          draw[dashed] (3,0,-1.5) -- (0,0,-1.5) -- (0,3,-1.5)
          (0,0,-1.5) -- (0,0,1.5);
          draw[thick,->] (3,0,-1.5) -- (5,0,-1.5);
          draw[thick,->] (0,3,-1.5) -- (0,5,-1.5);
          pic{3d block={x length=6,y length=6,z length=3}};
          draw[thick,->] (0,0,1.5) -- (0,0,4);
          foreach X in {E,F,G,H}
          {path (X) node[above]{X};}
          path[retrieve bounding box];
          end{tikzpicture}}
          makeatletter
          edeffigbb{(xmin,ymin) rectangle (xmax,ymax)}
          immediatewrite@mainaux{xdefstringfigbb{figbb}relax}
          makeatother
          end{document}


          enter image description here






          share|improve this answer


























          • Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

            – Concept7
            8 hours ago






          • 2





            @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

            – marmot
            8 hours ago






          • 1





            @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

            – marmot
            7 hours ago














          3












          3








          3







          It is not the point (0,0,0) that changes but the bounding box. To prevent this from happening, you can set a bounding box yourself, e.g. by saying



            path[use as bounding box] (-4,-1.45) rectangle (4,4);


          This yields



          documentclass[tikz, border=1cm]{standalone}

          usepackage{tkz-euclide}
          usetkzobj{all}

          begin{document}

          foreach vari in {0,5,10,15,...,360}
          {

          begin{tikzpicture}
          path[use as bounding box] (-4,-1.45) rectangle (4,4);
          begin{scope}
          [
          scale=.5,
          x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
          rotate around z=vari
          ]

          % coordinates
          coordinate (A) at (3,-3,0);
          coordinate (B) at (3,3,0);
          coordinate (C) at (-3,3,0);
          coordinate (D) at (-3,-3,0);
          coordinate (E) at (3,-3,3);
          coordinate (F) at (3,3,3);
          coordinate (G) at (-3,3,3);
          coordinate (H) at (-3,-3,3);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

          % Axes 3d

          draw[->,>=stealth] (3,0,0) -- (5,0,0);
          draw[->,>=stealth] (0,3,0) -- (0,5,0);
          draw[dashed] (0,0,0) -- (0,0,4);
          draw[dashed] (0,0,0) -- (0,3,0);
          draw[dashed] (0,0,0) -- (3,0,0);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

          tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
          tkzLabelPoints[above](E,F,G,H)
          tkzLabelPoints[below](A,B,C,D)

          draw[->,>=stealth] (0,0,4) -- (0,0,7);
          end{scope}
          end{tikzpicture}
          }
          end{document}


          enter image description here



          However, I would recommend tikz-3dplot for that. It allows you to do orthographic projections, and makes it more easy to distinguish hidden from foreground faces. I also use [a routine to determine the minimal bounding box that fits all frames.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage{tikz-3dplot}
          newcounter{x}
          newcounter{y}
          newcounter{z}
          tikzset{plane/.style n args={3}{insert path={%
          #1 -- ++ #2 -- ++ #3 -- ++ ($-1*#2$) -- cycle}},
          xy plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}},
          xz plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          yz plane/.style={plane={#1}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          get projections/.style={insert path={%
          let p1=(1,0,0),p2=(0,1,0) in
          [/utils/exec={pgfmathtruncatemacro{xproj}{sign(x1)}xdefxproj{xproj}
          pgfmathtruncatemacro{yproj}{sign(x2)}xdefyproj{yproj}
          pgfmathtruncatemacro{zproj}{sign(cos(tdplotmaintheta))}xdefzproj{zproj}}]}},
          pics/3d block/.style={code={
          tikzset{3d block/.cd,#1}
          path[get projections];
          ifnumzproj=-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumzproj>-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          }},
          3d block/.cd,
          xy face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          xz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          yz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          every face/.style={draw,very thick},
          x length/.initial=1,
          y length/.initial=1,
          z length/.initial=1,
          /tikz/retrieve bounding box/.style={insert path={
          let p1=(current bounding box.south west),
          p2=(current bounding box.north east)
          in pgfextra{%
          pgfmathsetmacro{xmin}{min(x1,xmin)}
          pgfmathsetmacro{xmax}{max(x2,xmax)}
          pgfmathsetmacro{ymin}{min(y1,ymin)}
          pgfmathsetmacro{ymax}{max(y2,ymax)}
          xdefxmin{xmin pt}
          xdefxmax{xmax pt}
          xdefymin{ymin pt}
          xdefymax{ymax pt}
          %typeout{xmin,xmax,ymin,ymax}
          }}}}
          pgfmathsetmacro{xmin}{0}
          pgfmathsetmacro{xmax}{0}
          pgfmathsetmacro{ymin}{0}
          pgfmathsetmacro{ymax}{0}
          begin{document}
          foreach vari in {0,5,10,15,...,360}
          {tdplotsetmaincoords{70}{vari} % the first argument cannot be larger than 90
          begin{tikzpicture}[line join=round,tdplot_main_coords,>=stealth]
          ifdefinedfigbbrelax
          path figbb;
          fi
          coordinate (A) at (3,-3,-1.5);
          coordinate (B) at (3,3,-1.5);
          coordinate (C) at (-3,3,-1.5);
          coordinate (D) at (-3,-3,-1.5);
          coordinate (E) at (3,-3,1.5);
          coordinate (F) at (3,3,1.5);
          coordinate (G) at (-3,3,1.5);
          coordinate (H) at (-3,-3,1.5);
          foreach X in {A,B,C,D}
          {path (X) node[below]{X};}
          draw[dashed] (3,0,-1.5) -- (0,0,-1.5) -- (0,3,-1.5)
          (0,0,-1.5) -- (0,0,1.5);
          draw[thick,->] (3,0,-1.5) -- (5,0,-1.5);
          draw[thick,->] (0,3,-1.5) -- (0,5,-1.5);
          pic{3d block={x length=6,y length=6,z length=3}};
          draw[thick,->] (0,0,1.5) -- (0,0,4);
          foreach X in {E,F,G,H}
          {path (X) node[above]{X};}
          path[retrieve bounding box];
          end{tikzpicture}}
          makeatletter
          edeffigbb{(xmin,ymin) rectangle (xmax,ymax)}
          immediatewrite@mainaux{xdefstringfigbb{figbb}relax}
          makeatother
          end{document}


          enter image description here






          share|improve this answer















          It is not the point (0,0,0) that changes but the bounding box. To prevent this from happening, you can set a bounding box yourself, e.g. by saying



            path[use as bounding box] (-4,-1.45) rectangle (4,4);


          This yields



          documentclass[tikz, border=1cm]{standalone}

          usepackage{tkz-euclide}
          usetkzobj{all}

          begin{document}

          foreach vari in {0,5,10,15,...,360}
          {

          begin{tikzpicture}
          path[use as bounding box] (-4,-1.45) rectangle (4,4);
          begin{scope}
          [
          scale=.5,
          x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},
          rotate around z=vari
          ]

          % coordinates
          coordinate (A) at (3,-3,0);
          coordinate (B) at (3,3,0);
          coordinate (C) at (-3,3,0);
          coordinate (D) at (-3,-3,0);
          coordinate (E) at (3,-3,3);
          coordinate (F) at (3,3,3);
          coordinate (G) at (-3,3,3);
          coordinate (H) at (-3,-3,3);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](C,D,H,G)

          % Axes 3d

          draw[->,>=stealth] (3,0,0) -- (5,0,0);
          draw[->,>=stealth] (0,3,0) -- (0,5,0);
          draw[dashed] (0,0,0) -- (0,0,4);
          draw[dashed] (0,0,0) -- (0,3,0);
          draw[dashed] (0,0,0) -- (3,0,0);

          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,C,D)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](B,C,G,F)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,D,H,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](A,B,F,E)
          tkzDrawPolygon[fill=blue!20,opacity=.5,rounded corners=.1pt](G,H,E,F)

          tkzDrawSegments[ultra thick](A,B B,C C,G G,H H,E E,F E,A F,B F,G)
          tkzLabelPoints[above](E,F,G,H)
          tkzLabelPoints[below](A,B,C,D)

          draw[->,>=stealth] (0,0,4) -- (0,0,7);
          end{scope}
          end{tikzpicture}
          }
          end{document}


          enter image description here



          However, I would recommend tikz-3dplot for that. It allows you to do orthographic projections, and makes it more easy to distinguish hidden from foreground faces. I also use [a routine to determine the minimal bounding box that fits all frames.



          documentclass[tikz,border=3.14mm]{standalone}
          usepackage{tikz-3dplot}
          newcounter{x}
          newcounter{y}
          newcounter{z}
          tikzset{plane/.style n args={3}{insert path={%
          #1 -- ++ #2 -- ++ #3 -- ++ ($-1*#2$) -- cycle}},
          xy plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}},
          xz plane/.style={plane={#1}{(pgfkeysvalueof{/tikz/3d block/x length},0,0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          yz plane/.style={plane={#1}{(0,pgfkeysvalueof{/tikz/3d block/y length},0)}{(0,0,pgfkeysvalueof{/tikz/3d block/z length})}},
          get projections/.style={insert path={%
          let p1=(1,0,0),p2=(0,1,0) in
          [/utils/exec={pgfmathtruncatemacro{xproj}{sign(x1)}xdefxproj{xproj}
          pgfmathtruncatemacro{yproj}{sign(x2)}xdefyproj{yproj}
          pgfmathtruncatemacro{zproj}{sign(cos(tdplotmaintheta))}xdefzproj{zproj}}]}},
          pics/3d block/.style={code={
          tikzset{3d block/.cd,#1}
          path[get projections];
          ifnumzproj=-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumyproj=1
          path[3d block/every face,3d block/yz face,yz plane={
          (pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/yz face,yz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumxproj=1
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xz face,xz plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          ifnumzproj>-1
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          else
          path[3d block/every face,3d block/xy face,xy plane={
          (-pgfkeysvalueof{/tikz/3d block/x length}/2,
          -pgfkeysvalueof{/tikz/3d block/y length}/2,
          -pgfkeysvalueof{/tikz/3d block/z length}/2)}];
          fi
          }},
          3d block/.cd,
          xy face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          xz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          yz face/.style={fill=blue!20,opacity=.5,rounded corners=.1pt},
          every face/.style={draw,very thick},
          x length/.initial=1,
          y length/.initial=1,
          z length/.initial=1,
          /tikz/retrieve bounding box/.style={insert path={
          let p1=(current bounding box.south west),
          p2=(current bounding box.north east)
          in pgfextra{%
          pgfmathsetmacro{xmin}{min(x1,xmin)}
          pgfmathsetmacro{xmax}{max(x2,xmax)}
          pgfmathsetmacro{ymin}{min(y1,ymin)}
          pgfmathsetmacro{ymax}{max(y2,ymax)}
          xdefxmin{xmin pt}
          xdefxmax{xmax pt}
          xdefymin{ymin pt}
          xdefymax{ymax pt}
          %typeout{xmin,xmax,ymin,ymax}
          }}}}
          pgfmathsetmacro{xmin}{0}
          pgfmathsetmacro{xmax}{0}
          pgfmathsetmacro{ymin}{0}
          pgfmathsetmacro{ymax}{0}
          begin{document}
          foreach vari in {0,5,10,15,...,360}
          {tdplotsetmaincoords{70}{vari} % the first argument cannot be larger than 90
          begin{tikzpicture}[line join=round,tdplot_main_coords,>=stealth]
          ifdefinedfigbbrelax
          path figbb;
          fi
          coordinate (A) at (3,-3,-1.5);
          coordinate (B) at (3,3,-1.5);
          coordinate (C) at (-3,3,-1.5);
          coordinate (D) at (-3,-3,-1.5);
          coordinate (E) at (3,-3,1.5);
          coordinate (F) at (3,3,1.5);
          coordinate (G) at (-3,3,1.5);
          coordinate (H) at (-3,-3,1.5);
          foreach X in {A,B,C,D}
          {path (X) node[below]{X};}
          draw[dashed] (3,0,-1.5) -- (0,0,-1.5) -- (0,3,-1.5)
          (0,0,-1.5) -- (0,0,1.5);
          draw[thick,->] (3,0,-1.5) -- (5,0,-1.5);
          draw[thick,->] (0,3,-1.5) -- (0,5,-1.5);
          pic{3d block={x length=6,y length=6,z length=3}};
          draw[thick,->] (0,0,1.5) -- (0,0,4);
          foreach X in {E,F,G,H}
          {path (X) node[above]{X};}
          path[retrieve bounding box];
          end{tikzpicture}}
          makeatletter
          edeffigbb{(xmin,ymin) rectangle (xmax,ymax)}
          immediatewrite@mainaux{xdefstringfigbb{figbb}relax}
          makeatother
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 7 hours ago

























          answered 8 hours ago









          marmotmarmot

          143k6 gold badges187 silver badges345 bronze badges




          143k6 gold badges187 silver badges345 bronze badges













          • Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

            – Concept7
            8 hours ago






          • 2





            @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

            – marmot
            8 hours ago






          • 1





            @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

            – marmot
            7 hours ago



















          • Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

            – Concept7
            8 hours ago






          • 2





            @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

            – marmot
            8 hours ago






          • 1





            @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

            – marmot
            7 hours ago

















          Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

          – Concept7
          8 hours ago





          Do you mean load tikz-3dplot instead of tikz package? Is there a possible significant reduction in code complexity? I haven't looked into tikz-3dplot package so I don't know the commands available in it.

          – Concept7
          8 hours ago




          2




          2





          @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

          – marmot
          8 hours ago





          @Concept7 The tikz-3dplot package loads tikz and allows you to set the view angles and then does an orthographic projection. That is, it will replace ` x={(-1cm,-.25cm)},y={(1cm,-.25cm)},z={(0cm,1cm)},` by something entirely fixed by the view angles.

          – marmot
          8 hours ago




          1




          1





          @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

          – marmot
          7 hours ago





          @Concept7 I added a tikz-3dplot version. True, one needs more preparations, but you can adjust the view more easily and can also more easily distinguish between foreground and background faces.

          – marmot
          7 hours ago


















          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%2f499021%2fhow-to-anchor-the-origin-0-0-0-to-the-center-of-multiple-generated-images-in-t%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...