[R] placing labels in polygon center ?
Richard A. O'Keefe
ok at cs.otago.ac.nz
Thu Aug 14 07:27:54 CEST 2003
I found myself wishing for a function to rotate a vector.
Is there one? I know about ?lag, but help.search("rotate")
didn't find anything to the point.
Here I was regarding a vector as a _sequence_.
The (one-step) rotation of c(u,v,w,x,y,z) is c(v,w,x,y,z,u).
This is pretty much the way APL uses the word "rotate" (the
Spencer Graves <spencer.graves at PDF.COM> replied:
I didn't study your code, but regarding a function to rotate a
vector: Multiplication by an orthogonal matrix does that.
This is a misunderstanding. We were both using the word "rotate" in
a standard way, the problem is that it has more than one "standard" meaning.
As a matter of fact,
/ 0 1 0 0 \ / u \ / v \
| 0 0 1 0 | | v | | w |
| 0 0 0 1 | | w | = | x |
\ 1 0 0 0 / \ x / \ u /
so you *can* do the kind of rotation I want using a matrix multiplication,
and this is mathematically useful; it's just not a very good way to do
it in a computer.
More information about the R-help