# TikZ Coordinate calculation - calculate coordinates separately

I'm trying to calculate coordinates based on existing coordinates but each coordinate individually.

The first thing which is unclear to me is how to define scalar variables. I can define coordinates using the \coordinate command, but what about scalars?

Looking through the manual I found the \pgfextractx command, but I don't know how to use it, is it possible to use it within a coordinate calculation like for example

\coordinate(blah) at ($(\pgfextractx{(centre)} + 2*cos(30), .. )$)


?

-
What do you mean exactly with "calculate coordinates based on existing coordinates but each coordinate individually"? I have the feeling you use "coordinate" for both \coordinate and the X and Y part of it, which makes the question quite difficult to read. –  Martin Scharrer May 2 '11 at 9:52
Agree this was somewhat confusing, I just want to access the x and y part of it separately instead of, let's say just multiply the coordinate vector with a scalar. –  Nils May 2 '11 at 11:30
You could define scalars with \newcommand. –  Caramdir May 2 '11 at 14:57

It is possible to do by means of let operation:

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}

It's a bad idea to use \pgfmathresult inside a coordinate. This macro is overwritten by any pgfmath operation. It is much saver to use \pgfmathsetmacro\myresult{...} instead of \pgfmathparse{...} and then \myresult pt as X-coordinate. Note that \pgfmathresult is in pt but without the unit, so just using it alone will give you wrong results except when x=1pt is in affect. –  Martin Scharrer May 2 '11 at 11:37
@Nils: with v2.00 you have to write ... circle (1pt) instead of ... circle [radius=1pt]. –  Caramdir May 2 '11 at 14:44