Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Rotations of points around points..

Subject: Rotations of points around points..

From: DRG

Date: 8 Oct, 2010 13:54:31

Message: 1 of 2

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!

Subject: Rotations of points around points..

From: Roger Stafford

Date: 8 Oct, 2010 20:44:04

Message: 2 of 2

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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us