Origin for polar coordinates

View: New views
2 Messages — Rating Filter:   Alert me  

Origin for polar coordinates

by Sebastián PEÑA SALDARRIAGA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi pgf users,

I saw this example in Kjell Magne's site (
http://www.texample.net/tikz/examples/rgb-color-mixing/ ). I have a
question about the following code :

\foreach \x in {0,0.0111,...,1} {
        \definecolor{currentcolor}{hsb}{\x, 1, 1}
        \draw[draw=none, fill=currentcolor]
                (-360*\x+88:2) -- (-360*\x+88:3.8)
                -- (-360*\x+92:3.8) -- (-360*\x+92:2) -- cycle;
}

How can I specify the origin for polar coordinates ? Actually, I want to
do some absolute positioning by changing the center of the circle.

Thanks

Sebastian

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Origin for polar coordinates

by Kjell Magne Fauske :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/9/16 Sebastián Peña Saldarriaga
<sebastian.pena-saldarriaga@...>:

> Hi pgf users,
>
> I saw this example in Kjell Magne's site (
> http://www.texample.net/tikz/examples/rgb-color-mixing/ ). I have a
> question about the following code :
>
> \foreach \x in {0,0.0111,...,1} {
>        \definecolor{currentcolor}{hsb}{\x, 1, 1}
>        \draw[draw=none, fill=currentcolor]
>                (-360*\x+88:2) -- (-360*\x+88:3.8)
>                -- (-360*\x+92:3.8) -- (-360*\x+92:2) -- cycle;
> }
>
> How can I specify the origin for polar coordinates ? Actually, I want to
> do some absolute positioning by changing the center of the circle.
>

Transformations are your friends here. You can for instance use a scope:

\begin{scope}[shift=(x,y)]
...
\end{scope}
(where x,y is the coordinate of the origin)

You can also apply a transformation directly to the path:

        \draw[draw=none, fill=currentcolor, shift=(x,y)]
                (-360*\x+88:2) -- (-360*\x+88:3.8)
                -- (-360*\x+92:3.8) -- (-360*\x+92:2) -- cycle;


- Kjell Magne Fauske

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users