Graphics, Figures & TablesA node on an exact coordinate

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ehud
Posts: 3
Joined: Tue Jul 18, 2017 11:38 pm

A node on an exact coordinate

Post by ehud »

I want my filldraw circle to be placed at coordinates (x,y)=(cos(30°), sin(30°)) - a point on the unit circle with angle 30°.
These are (actually) equivalent to (x,y)=(√3/2,1/2), or approximately (0.866,0.5).

So, how can I assign these coordinate as (cos(30°), sin(30°)) to my node, label, or any other object in my TikZ document, so that I am not working in the approximated regime?

Code: Select all

Code, edit and compile here:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw [help lines] (-4,-4) grid (4,4);
\filldraw [black] (0,0) circle [radius=2pt];
\filldraw [black] (+0.866,-0.5) circle [radius=2pt]; %right
\filldraw [black] (-0.866,-0.5) circle [radius=2pt]; %left
\filldraw [black] (0,1) circle [radius=2pt]; %top
\draw [blue, very thin] (0,0) circle [radius=1 cm];
\end{tikzpicture}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

thomasb
Posts: 134
Joined: Thu Aug 03, 2017 10:54 am

A node on an exact coordinate

Post by thomasb »

Formulas seem to be for plot function only (section 3.9, page 11) : http://cremeronline.com/LaTeX/minimaltikz.pdf

(redit : Tikz doesn't have \frac{\pi}{2} (section 2.12, page 32) : http://www.texample.net/media/pgf/build ... -11-04.pdf)
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

A node on an exact coordinate

Post by rais »

ehud wrote:I want my filldraw circle to be placed at coordinates (x,y)=(cos(30°), sin(30°)) - a point on the unit circle with angle 30°.
These are (actually) equivalent to (x,y)=(√3/2,1/2), or approximately (0.866,0.5).

So, how can I assign these coordinate as (cos(30°), sin(30°)) to my node, label, or any other object in my TikZ document, so that I am not working in the approximated regime?
you could use polar coordinates, see `texdoc pgfmanual', section (2.15) Specifying Coordinates.

Code: Select all

Code, edit and compile here:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw [help lines] (-4,-4) grid (4,4);
\filldraw [black] (0,0) circle [radius=2pt];
\filldraw [black] (+0.866,-0.5) circle [radius=2pt]; %right
\filldraw [black] (-0.866,-0.5) circle [radius=2pt]; %left
\filldraw [black] (0,1) circle [radius=2pt]; %top
\filldraw [red] (30:1) circle [radius=2pt]; % top right
\filldraw [red] (150:1) circle [radius=2pt]; % top left
\filldraw [red] (270:1) circle [radius=2pt]; % bottom
\draw [blue, very thin] (0,0) circle [radius=1 cm];
\end{tikzpicture}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
KR
Rainer
ehud
Posts: 3
Joined: Tue Jul 18, 2017 11:38 pm

A node on an exact coordinate

Post by ehud »

@rais - Thank you. It works.
Post Reply