Graphics, Figures & TablesFigure repeatability and relative positioning within a float

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ZeV
Posts: 7
Joined: Sat Feb 26, 2011 12:06 pm

Figure repeatability and relative positioning within a float

Post by ZeV »

Hello everyone. I am not new to LaTeX, but I am new to tikz. I am playing around with it today, in anticipation of a lab report on some semiconductor experiments I am running, and have made a simple 3D representation of a GaAs unit cell in tikz. However, I am uncertain about how to:
  • Rotate/align the figure in three dimensions
  • Position the picture relative another figure/picture in the same float
Ideally I intend to position the unit cell at given coordinates within my figure, and then - within the same figure (or at least float) make a visualization of my GaAs substrate

Code: Select all

\newcommand{\AtomOne}[1]{%
    \shade[ball color=green!20,fill opacity=0.5] (#1) circle (0.5);\draw (#1);
}
\newcommand{\AtomTwo}[1]{%
    \shade[ball color=blue!20,fill opacity=0.5] (#1) circle (0.5);\draw (#1);
}
\newcommand{\AtomThree}[1]{%
\shade[ball color=yellow!20,fill opacity=0.5] (#1) circle (1);\draw (#1);
}
\newcommand{\UnitCell}{%
\draw 	[color=gray!25](0,0,10)--(0,0,0)--(0,10,0)
		(0,0,0)--(10,0,0)--(10,10,0)--(10,10,10)--(10,0,10)--(10,0,0)%
		(10,10,10)--(0,10,10)--(0,10,0)
		(10,10,0)--(0,10,0) (10,0,10)--(0,0,10)--(0,10,10);

		\draw [red,very thick] 	(10,10,10)--(7.5,7.5,7.5)--(10,5,5)(5,5,10)--(7.5,7.5,7.5)--(5,10,5)
								(5,10,5)--(2.5,7.5,2.5)--(0,10,0)(5,5,0)--(2.5,7.5,2.5)--(0,5,5)
								(0,0,10)--(2.5,2.5,7.5)--(5,5,10)(5,0,5)--(2.5,2.5,7.5)--(0,5,5)
								(10,0,0)--(7.5,2.5,2.5)--(10,5,5)(5,0,5)--(7.5,2.5,2.5)--(10,5,5);		
				%\draw (10,0,0) node {X};
				%\draw (0,10,0) node {Y};
				%\draw (0,0,10) node {Z};

\AtomOne{0,10,0}
\AtomOne{0,10,10}
\AtomOne{0,0,0}
\AtomOne{0,0,10}
\AtomOne{0,5,5}
\AtomOne{5,5,0}
\AtomOne{5,0,5}
\AtomOne{10,0,0}
\AtomOne{10,0,10}
\AtomOne{10,10,10}
\AtomOne{10,10,0}
\AtomOne{10,5,5}
\AtomOne{5,10,5}
\AtomOne{5,5,10}

\AtomTwo{2.5,7.5,2.5}
\AtomTwo{2.5,2.5,7.5}
\AtomTwo{7.5,2.5,2.5}
\AtomTwo{7.5,7.5,7.5}
}


\begin{tikzpicture}[scale=.25]

\UnitCell{0,0,0}
\end{tikzpicture}
Last edited by ZeV on Sun Feb 27, 2011 12:22 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figure repeatability and relative positioning within a float

Post by localghost »

You have done a great job so far. The Zinc blende structure of GaAs is clearly to see. But since pgf/tikZ has only very limited capabilities regarding 3D, you should take I look at the tikZ-3dplot package. I think it will answer all your questions and fix all issues.


Best regards and welcome to the board
Thorsten
ZeV
Posts: 7
Joined: Sat Feb 26, 2011 12:06 pm

Figure repeatability and relative positioning within a float

Post by ZeV »

Whoa! That was easy! Thank you VERY much! :D
Post Reply