Trying to rotate a 3D matrix for full symmetry group (group theory)

4 Ansichten (letzte 30 Tage)
Simon Penninag
Simon Penninag am 6 Mär. 2021
Kommentiert: Jan am 7 Mär. 2021
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 Kommentare
Jan
Jan am 7 Mär. 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));

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by