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

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
10/25/12 1:46pm

Suppose you can turn your three rotations into a single rotationMatrix, that seems conventional.

Suppose you add a translationVector, rather than multiplying by a translation, that seems conventional.

Then this function seems like it will do what you want.

rotateAndTranslate[listOfPoints_] :=
Map[rotationMatrix.# + translationVector &, listOfPoints]

Map[someFunction,someList] will do someFunction to each member of someList and return a list off all those results. # and & is a cryptic sometimes confusing notation often used for this. The # is the point being operated on and the & indicates to Mathematica that all this is a function.

That tiny little almost invisible "." between rotationMatrix and # is multiplying your matrix times your point.

Try this first on some REALLY simple hand crafted data and rotation matrix. Verify it works on a few points. Try slightly a more complicated rotation matrix and verify that it still works. Verify that a translation vector of {0,0,0} doesn't translate at all. etc, etc, etc.

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
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic