3-D geometric transformation of a matrix of 3-D points

2 vues (au cours des 30 derniers jours)
Andrea Alberti
Andrea Alberti le 5 Oct 2015
I have a set of nine 3-D points, with the following form:
e = 0.2;
points3d = [-e -e 0
-e 0 0
-e e 0
0 -e 0
0 0 0
0 e 0
e -e 0
e 0 0
e e 0]';
I would like to apply a 3-D geometric transformation to this set of nine 3d points, so that they are rotated and translated to a random position. What is the easiest way to do this?
Thanks.

Réponse acceptée

Mike Garrity
Mike Garrity le 5 Oct 2015
Probably the simplest is something like this:
mat = makehgtform('axisrotate',[1 1 1],pi/5, 'translate',[1 2 3]);
newpts = mat * [points3d; ones(1,9)];
See this blog post for background. The examples in that post are mostly 2D to keep things compact, but the theory is the same in 3D.
  1 commentaire
Andrea Alberti
Andrea Alberti le 5 Oct 2015
Thanks, I like the makehgtform, very compact.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Object Containers dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by