Trying to rotate a 3D matrix for full symmetry group (group theory)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I currently have a 32x32x32 matrix and I'm trying to get all possible rotations of it (the full symmetry set) and store them all.
My code is shown below;
It takes a dataset as matrix and then rotates it in 7 different ways around the x axis, this gives me 8 out of the 24 rotations of the full set. Are there functions that do the same as what I did below for the other 2 axes (y and z)? I cannot find a function that does this, and am hesitant to remap everything manually since there's a dataset of 800.000 matrices that I have to do this with.
matrix = dataset(:,:,:,i);
matrix2=flip(matrix);
matrix3=flip(matrix,2);
matrix5=rot90(matrix);
matrix4=rot90(matrix,2);
matrix7=rot90(matrix,3);
matrix6=rot90(flip(matrix));
matrix8=rot90(flip(matrix),3);
7 commentaires
Jan
le 7 Mar 2021
Note that rot3d90 handles multidimensional inputs directly. So you can omit the loop:
matrix2 = rot3d90(a,1,1);
matrix3 = rot3d90(a,1,2);
matrix4 = rot3d90(a,1,3);
matrix5 = rot3d90(a,2,2);
matrix6 = rot3d90(matrix5,1,1);
matrix7 = rot3d90(matrix5,1,2);
matrix8 = rot3d90(matrix5,1,3);
matrix9 = rot3d90(a,2,1);
matrix10 = rot3d90(a,2,3);
matrix11 = rot3d90(matrix9,3,1);
matrix12 = rot3d90(matrix9,3,2);
matrix13 = rot3d90(matrix9,3,3);
matrix14 = rot3d90(matrix10,3,1);
matrix15 = rot3d90(matrix10,3,2);
matrix16 = rot3d90(matrix10,3,3);
matrix17 = rot3d90(a,3,1);
matrix18 = rot3d90(a,3,3);
matrix19 = rot3d90(matrix17,2,1);
matrix20 = rot3d90(matrix17,2,2);
matrix21 = rot3d90(matrix17,2,3);
matrix22 = rot3d90(matrix18,2,1);
matrix23 = rot3d90(matrix18,2,2);
matrix24 = rot3d90(matrix18,2,3);
p = [4, 1, 2, 3];
fullset = cat(1, ...
permute(a, p), ...
permute(matrix2, p), ...
permute(matrix3, p), ...
permute(matrix4, p), ...
permute(matrix5, p), ...
permute(matrix6, p), ...
permute(matrix7, p), ...
permute(matrix8, p), ...
permute(matrix9, p), ...
permute(matrix10, p), ...
permute(matrix11, p), ...
permute(matrix12, p), ...
permute(matrix13, p), ...
permute(matrix14, p), ...
permute(matrix15, p), ...
permute(matrix16, p), ...
permute(matrix17, p), ...
permute(matrix18, p), ...
permute(matrix19, p), ...
permute(matrix20, p), ...
permute(matrix21, p), ...
permute(matrix22, p), ...
permute(matrix23, p), ...
permute(matrix24, p));
Réponses (0)
Voir également
Catégories
En savoir plus sur Cell Arrays 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!