Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'More complex functions' topicStudent Support Forum > General > "More complex functions"

Next Comment >Help | Reply To Topic
Author Comment/Response
Roserio
10/25/12 08:44am

Dear Sir or Madam,

Currently I am trying to transform a set of 3D points from one referential to another. This is done by multiplying each individual 3D point by a rotation matrix and a translation vector. I would like to create a function which would accept as arguments:

- v1 = {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3}...} (a vector)
- the rotations: alpha, theta, gama, (3 variables)
- the translations: tx, ty, tz (3 variables)

and the output would be a vector with the transformed points:
- v2 = {{x1',y1',z1'},{x2',y2',z2'},{x3',y3'z3'}}

this function would be something like:

F[v2_] = [v1, alpha, theta, gama, tx, ty, tz]
{
Rotation = Rotx * Roty * Rotz
Translation = {tx, ty, tz, 0}

for [ i = 0, i < length(v1), i++

v2{i} = Rotation*translation*v1{i}
]
]

I tried to find more complex examples with for statements and function definitions to discover how to start but the true is that I am new in Mathematica and I do not even know if this can be done. I would be glad to have some tips on how to achieve this with a function to run the vector and make the transformation inside its scope.

Thank you
Cheers,
Roserio

URL: ,

Subject (listing for 'More complex functions')
Author Date Posted
More complex functions Roserio 10/25/12 08:44am
Re: More complex functions Bill Simpson 10/25/12 1:46pm
Re: Re: More complex functions Roserio 10/30/12 4:02pm
Next Comment >Help | Reply To Topic