Got Questions? Get Answers.
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:
Regarding affine transormation using maketform

Subject: Regarding affine transormation using maketform

From: Gautam

Date: 6 Jan, 2009 21:33:02

Message: 1 of 3

Hello,

I am trying to write MATLAB code to rotate a point in 3-space about an arbitrary axis. I have based my code on this article - http://local.wasp.uwa.edu.au/~pbourke/geometry/rotate/. The problem I am facing is that the maketform function expects the last column to comprise of all 0's except the last element in the last row which has to be a 1 for affine transformation. However, my composite transformation matrix does not adhere to this requirement. I am not sure I understand why the maketform function expects the last column to comprise of all 0s for an affine transformation. Any information on how to get around this problem would be appreciated.

- Gautam.

Subject: Regarding affine transormation using maketform

From: Roger Stafford

Date: 7 Jan, 2009 01:00:04

Message: 2 of 3

"Gautam " <gautam.s.muralidhar@gmail.com> wrote in message <gk0ime$8f1$1@fred.mathworks.com>...
> .......
> I am trying to write MATLAB code to rotate a point in 3-space about an arbitrary axis. > .......

  I like to think of rotation in terms of the dot and cross (inner and vector) products of vector analysis. If the axis of rotation points in a positive sense along the line from P1 = [x1,y1,z1] to P2 = [x2,y2,z2], and if the point Q = [x,y,z] is to undergo a right-hand rotation by angle theta about this axis, then it will move to the point R as given by:

 u = (P2-P1)/norm(P2-P1);
 QP = Q-P1;
 W = cross(u,QP);
 R = P1 + dot(QP,u)*u + cross(W,u)*cos(theta) + W*sin(theta);

  To get an insight into this last expression, the three right-hand oriented vectors dot(QP,u)*u, cross(W,u), and W are mutually orthogonal with QP being the sum of the first two. (The equality QP = dot(QP,u)*u + cross(W,u) is an identity.) The vectors cross(W,u) and W have the same magnitude. The rotation through angle theta preserves the first of these components while rotating the remaining component in a circle lying in a plane parallel to the second and third vectors, cross(W,u) and W, so the one is multiplied by cos(theta) and the other by sin(theta).

Roger Stafford

Subject: Regarding affine transormation using maketform

From: Steve Eddins

Date: 7 Jan, 2009 12:27:17

Message: 3 of 3

Gautam wrote:
> Hello,
>
> I am trying to write MATLAB code to rotate a point in 3-space about an
> arbitrary axis. I have based my code on this article -
> http://local.wasp.uwa.edu.au/~pbourke/geometry/rotate/. The problem I am
> facing is that the maketform function expects the last column to
> comprise of all 0's except the last element in the last row which has to
> be a 1 for affine transformation. However, my composite transformation
> matrix does not adhere to this requirement. I am not sure I understand
> why the maketform function expects the last column to comprise of all 0s
> for an affine transformation. Any information on how to get around this
> problem would be appreciated.
>
> - Gautam.

In the article at the link you provided, the transform matrices are
transposed from the convention used by the Image Processing Toolbox.
Notice in that article that the bottom row is all 0s except the last
element, which is 1.

---
Steve Eddins
http://blogs.mathworks.com/steve/

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