|
DRG <grimesd2@gmail.com> wrote in message <d6c8b25d-6586-4d9c-8f62-143fe158a773@c10g2000yqh.googlegroups.com>...
> Hey folks - not sure if this is more a matlab or trig question, but
> basically I have a group of four points I wish to rotate around a
> point. The central point is (dt,zt). The four points relative to this
> are
>
> A: (dt + a, zt + b)
> B: (dt + a, zt - b)
> C: (dt - c, zt - d)
> D: (dt - c, zt + d)
>
> where a,b,c,d are constants.
>
> I could work it manually by manipulating the trig but I need to do it
> quite often in my code and need to have explicits values returned. Is
> there any quicker way to do this that anyone might know ?
>
> Thanks in advance!
- - - - - - - - -
It is an elementary trigonometry problem but matlab is well equipped to solve it. I'll put in general terms. In the x-y plane if a point at (x1,y1) is rotated counterclockwise by an angle 'a' about a point (x0,y0), then it will arrive at point (x2,y2) in accordance with the equations
x2-x0 = (x1-x0)*cos(a) - (y1-y0)*sin(a)
y2-y0 = (x1-x0)*sin(a) + (y1-y0)*cos(a)
I'll let you take it from there.
Roger Stafford
|