Drawing a node parallel to any of the x, y or z axis in a rotated tridimensionnal picture












3















I want to draw a node exactly parallel to one of the three axes that are rotated. One solution could be to compute the axis angle relative to the horizontal line but I don't know what is the best way to do it by myself.



enter image description here



documentclass[tikz,border=.5cm]{standalone}

begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}

node[draw,rectangle,
rotate= 20, % 20 is not correct
] at(1cm,1cm){ (parallel x) axis};

end{tikzpicture}
end{document}









share|improve this question

























  • You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

    – marmot
    Oct 26 '18 at 21:59











  • Can someone please provide some documentation on how to use 3d library ?

    – Hafid Boukhoulda
    Oct 26 '18 at 22:04
















3















I want to draw a node exactly parallel to one of the three axes that are rotated. One solution could be to compute the axis angle relative to the horizontal line but I don't know what is the best way to do it by myself.



enter image description here



documentclass[tikz,border=.5cm]{standalone}

begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}

node[draw,rectangle,
rotate= 20, % 20 is not correct
] at(1cm,1cm){ (parallel x) axis};

end{tikzpicture}
end{document}









share|improve this question

























  • You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

    – marmot
    Oct 26 '18 at 21:59











  • Can someone please provide some documentation on how to use 3d library ?

    – Hafid Boukhoulda
    Oct 26 '18 at 22:04














3












3








3


1






I want to draw a node exactly parallel to one of the three axes that are rotated. One solution could be to compute the axis angle relative to the horizontal line but I don't know what is the best way to do it by myself.



enter image description here



documentclass[tikz,border=.5cm]{standalone}

begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}

node[draw,rectangle,
rotate= 20, % 20 is not correct
] at(1cm,1cm){ (parallel x) axis};

end{tikzpicture}
end{document}









share|improve this question
















I want to draw a node exactly parallel to one of the three axes that are rotated. One solution could be to compute the axis angle relative to the horizontal line but I don't know what is the best way to do it by myself.



enter image description here



documentclass[tikz,border=.5cm]{standalone}

begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}

node[draw,rectangle,
rotate= 20, % 20 is not correct
] at(1cm,1cm){ (parallel x) axis};

end{tikzpicture}
end{document}






tikz-pgf tikz-3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 at 19:30









Stefan Pinnow

19.7k83275




19.7k83275










asked Oct 26 '18 at 21:28









Hafid BoukhouldaHafid Boukhoulda

2,3321517




2,3321517













  • You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

    – marmot
    Oct 26 '18 at 21:59











  • Can someone please provide some documentation on how to use 3d library ?

    – Hafid Boukhoulda
    Oct 26 '18 at 22:04



















  • You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

    – marmot
    Oct 26 '18 at 21:59











  • Can someone please provide some documentation on how to use 3d library ?

    – Hafid Boukhoulda
    Oct 26 '18 at 22:04

















You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

– marmot
Oct 26 '18 at 21:59





You could use the 3d library for that. Just go in a scope canvas is yz plane at x=0.

– marmot
Oct 26 '18 at 21:59













Can someone please provide some documentation on how to use 3d library ?

– Hafid Boukhoulda
Oct 26 '18 at 22:04





Can someone please provide some documentation on how to use 3d library ?

– Hafid Boukhoulda
Oct 26 '18 at 22:04










1 Answer
1






active

oldest

votes


















2














There are two ways of reading your question, so this answer has two parts. The first picture makes use of the 3d library and the second one of calc. Note that, as of now, there is AFAIK no official documentation of the 3d library. On the other hand, the key canvas is xy plane at z=... etc. is sort of self-explaining.



documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
begin{scope}[canvas is xy plane at z=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel x) axis};
end{scope}
begin{scope}[canvas is yz plane at x=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel y) axis};
end{scope}
begin{scope}[canvas is zx plane at y=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel z) axis};
end{scope}

end{tikzpicture}
%
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
path let p1=(1,0,0),n1={atan2(y1,x1)} in
node[draw,rectangle,rotate=n1+180] at(1cm,1cm){ (parallel x) axis};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer



















  • 1





    For the record: Jake's patch is now incorporated in v3.1 of TikZ.

    – Stefan Pinnow
    Jan 15 at 19:29











  • ... and now there is also a documentation of the 3d library.

    – marmot
    Jan 15 at 19:33











  • *g, have fun to add that line to all the other places where I added that line ;)

    – Stefan Pinnow
    Jan 15 at 19:40











  • @StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

    – marmot
    Jan 15 at 19:43






  • 1





    Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

    – Stefan Pinnow
    Jan 15 at 19:52











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%2f456978%2fdrawing-a-node-parallel-to-any-of-the-x-y-or-z-axis-in-a-rotated-tridimensionna%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









2














There are two ways of reading your question, so this answer has two parts. The first picture makes use of the 3d library and the second one of calc. Note that, as of now, there is AFAIK no official documentation of the 3d library. On the other hand, the key canvas is xy plane at z=... etc. is sort of self-explaining.



documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
begin{scope}[canvas is xy plane at z=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel x) axis};
end{scope}
begin{scope}[canvas is yz plane at x=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel y) axis};
end{scope}
begin{scope}[canvas is zx plane at y=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel z) axis};
end{scope}

end{tikzpicture}
%
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
path let p1=(1,0,0),n1={atan2(y1,x1)} in
node[draw,rectangle,rotate=n1+180] at(1cm,1cm){ (parallel x) axis};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer



















  • 1





    For the record: Jake's patch is now incorporated in v3.1 of TikZ.

    – Stefan Pinnow
    Jan 15 at 19:29











  • ... and now there is also a documentation of the 3d library.

    – marmot
    Jan 15 at 19:33











  • *g, have fun to add that line to all the other places where I added that line ;)

    – Stefan Pinnow
    Jan 15 at 19:40











  • @StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

    – marmot
    Jan 15 at 19:43






  • 1





    Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

    – Stefan Pinnow
    Jan 15 at 19:52
















2














There are two ways of reading your question, so this answer has two parts. The first picture makes use of the 3d library and the second one of calc. Note that, as of now, there is AFAIK no official documentation of the 3d library. On the other hand, the key canvas is xy plane at z=... etc. is sort of self-explaining.



documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
begin{scope}[canvas is xy plane at z=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel x) axis};
end{scope}
begin{scope}[canvas is yz plane at x=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel y) axis};
end{scope}
begin{scope}[canvas is zx plane at y=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel z) axis};
end{scope}

end{tikzpicture}
%
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
path let p1=(1,0,0),n1={atan2(y1,x1)} in
node[draw,rectangle,rotate=n1+180] at(1cm,1cm){ (parallel x) axis};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer



















  • 1





    For the record: Jake's patch is now incorporated in v3.1 of TikZ.

    – Stefan Pinnow
    Jan 15 at 19:29











  • ... and now there is also a documentation of the 3d library.

    – marmot
    Jan 15 at 19:33











  • *g, have fun to add that line to all the other places where I added that line ;)

    – Stefan Pinnow
    Jan 15 at 19:40











  • @StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

    – marmot
    Jan 15 at 19:43






  • 1





    Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

    – Stefan Pinnow
    Jan 15 at 19:52














2












2








2







There are two ways of reading your question, so this answer has two parts. The first picture makes use of the 3d library and the second one of calc. Note that, as of now, there is AFAIK no official documentation of the 3d library. On the other hand, the key canvas is xy plane at z=... etc. is sort of self-explaining.



documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
begin{scope}[canvas is xy plane at z=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel x) axis};
end{scope}
begin{scope}[canvas is yz plane at x=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel y) axis};
end{scope}
begin{scope}[canvas is zx plane at y=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel z) axis};
end{scope}

end{tikzpicture}
%
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
path let p1=(1,0,0),n1={atan2(y1,x1)} in
node[draw,rectangle,rotate=n1+180] at(1cm,1cm){ (parallel x) axis};
end{tikzpicture}
end{document}


enter image description here






share|improve this answer













There are two ways of reading your question, so this answer has two parts. The first picture makes use of the 3d library and the second one of calc. Note that, as of now, there is AFAIK no official documentation of the 3d library. On the other hand, the key canvas is xy plane at z=... etc. is sort of self-explaining.



documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{3d}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
usetikzlibrary{calc}
begin{document}
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
begin{scope}[canvas is xy plane at z=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel x) axis};
end{scope}
begin{scope}[canvas is yz plane at x=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel y) axis};
end{scope}
begin{scope}[canvas is zx plane at y=0,transform shape]
node[draw,rectangle,] at(1,1){ (parallel z) axis};
end{scope}

end{tikzpicture}
%
begin{tikzpicture}[rotate around y=-80,rotate around x=-100,rotate around z=-20]
begin{scope}[->]
draw(0,0,0)coordinate(O)--+(1,0,0)node[above]{(x)};
draw(O)--+(0,1,0)node[above]{(y)};
draw(O)--+(0,0,1)node[left]{(z)};
end{scope}
path let p1=(1,0,0),n1={atan2(y1,x1)} in
node[draw,rectangle,rotate=n1+180] at(1cm,1cm){ (parallel x) axis};
end{tikzpicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 27 '18 at 0:07









marmotmarmot

93.8k4109208




93.8k4109208








  • 1





    For the record: Jake's patch is now incorporated in v3.1 of TikZ.

    – Stefan Pinnow
    Jan 15 at 19:29











  • ... and now there is also a documentation of the 3d library.

    – marmot
    Jan 15 at 19:33











  • *g, have fun to add that line to all the other places where I added that line ;)

    – Stefan Pinnow
    Jan 15 at 19:40











  • @StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

    – marmot
    Jan 15 at 19:43






  • 1





    Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

    – Stefan Pinnow
    Jan 15 at 19:52














  • 1





    For the record: Jake's patch is now incorporated in v3.1 of TikZ.

    – Stefan Pinnow
    Jan 15 at 19:29











  • ... and now there is also a documentation of the 3d library.

    – marmot
    Jan 15 at 19:33











  • *g, have fun to add that line to all the other places where I added that line ;)

    – Stefan Pinnow
    Jan 15 at 19:40











  • @StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

    – marmot
    Jan 15 at 19:43






  • 1





    Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

    – Stefan Pinnow
    Jan 15 at 19:52








1




1





For the record: Jake's patch is now incorporated in v3.1 of TikZ.

– Stefan Pinnow
Jan 15 at 19:29





For the record: Jake's patch is now incorporated in v3.1 of TikZ.

– Stefan Pinnow
Jan 15 at 19:29













... and now there is also a documentation of the 3d library.

– marmot
Jan 15 at 19:33





... and now there is also a documentation of the 3d library.

– marmot
Jan 15 at 19:33













*g, have fun to add that line to all the other places where I added that line ;)

– Stefan Pinnow
Jan 15 at 19:40





*g, have fun to add that line to all the other places where I added that line ;)

– Stefan Pinnow
Jan 15 at 19:40













@StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

– marmot
Jan 15 at 19:43





@StefanPinnow I don't think it is necessary at any other place. The reason to add it here is this comment.

– marmot
Jan 15 at 19:43




1




1





Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

– Stefan Pinnow
Jan 15 at 19:52





Ok, agree. But maybe I add another comment with this information to Jake's answer. Good idea @marmot.

– Stefan Pinnow
Jan 15 at 19:52


















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%2f456978%2fdrawing-a-node-parallel-to-any-of-the-x-y-or-z-axis-in-a-rotated-tridimensionna%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

How to send String Array data to Server using php in android

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Is anime1.com a legal site for watching anime?