Hi, I didn't quite understand the code. I simplified it a bit, removed many noop instructions, changed the speed, negated the twiddling and the result looks like a nice lobe of a p orbital, made up of points along some spiral, rotating about its axis. Is this the rotation you want or do you want to rotate the symmetry axis from the z direction to an arbitrary direction? You could apply a 3x3 rotation matrix to the $points array in the code below. If you want a point to remain fixed, first translate it to the origin, the rotate, and then rotate back. Regards, Luis ---------------- ################################################## use PDL; use PDL::Complex; use PDL::Graphics::TriD; use PDL::Math; nokeeptwiddling3d; my $c = 10; ## speed while(1){ for my $phase(-360..360) { ## 360 my $photons = 4178; ### [Density] 2444 4178 my $t=rvals(zeros($photons)); my $cz=$c; # -1**$t*$c my $cy=sin($t*$c); my $cx=sin($t)*$c; my $w=$cz-$cy-$cx; my $color=(pdl[my $r=cos($cy+$c+$cz), my $g=sin($w), my $b=cos($w)])->mv(-1,0); my $i=($cz-$cx-$cy); my $q=$c*($i*$phase); my $R = $b*sin($b); my $phi = $r*$q; my $theta = $g*cos($g); my $points=($R*pdl[sin($theta)*cos($phi), sin($phi)*sin($theta),cos($theta)])->mv(-1,0); points3d $points,$color; } }
On Fri, Oct 13, 2023 at 10:36:17AM -0700, Mark NanoNebulas wrote: > Hi im trying to rotate this obital so that i can place them all over in > balanced arrangements of orbs like the chemistry book says but i dont know > how to rotate a matrix in all directions, can anybody help > heres the code > > ################################################## > use PDL; > use PDL::Complex; > use PDL::Graphics::TriD; > use PDL::Math; keeptwiddling3d; > $PDL::BIGPDL=1; > ## remember this can crash the computer if you dont have enough RAM and > swap in linux or pagefile in windows > > > > for (;;){ > $c = (400) ; ## speed > for $phase(-360..360) { ## 360 > $phases = $phase*0.0000001; > $frequency = ($c**-1); > $n= (6.28*$c*$frequency+($phases)); > > $photons = 4178; ### [Density] 2444 4178 > > > $t=rvals(exp(zeros($photons))); > $cz=-1**$t*$c; # -1**$t*$c > $cy=-1**sin($t*$c); #-1**$c*sin($t*$c) > $cx=-1**$c*sin(rvals($t))*$c; #-1**$c*bessj0(rvals($t,{Centre=>[0]}))*$c; > > > $w=$cz-$cy-$cx; > $g=sin($w); #sin > $r=cos($cy+$c+$cz); #cos > $b=cos($w); #cos > $i=($cz-$cx-$cy); > $q=$c*($i*$n); > $xx = $b*sin($b); ### > $yy = $r*($q); ### > $zz = $g*cos($g); ### > > $xxx = $xx*cos($yy)*sin($zz); ### > $yyy = $xx*sin($yy)*sin($zz); ### > $zzz = $xx*cos($zz); > > points3d[$xxx,$yyy,$zzz],[$r,$g,$b]; > > ########################################################## > > if i can get this orbital to rotate in all directions, then i can represent > atoms > better cause they are balanced by the number of electrons so the orbs > repeal each other, please any help would be appreciated !!! > > Best, > -Mark Baker > _______________________________________________ > pdl-general mailing list > pdl-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pdl-general -- o W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ Av. Universidad s/n CP 62210 | (*)/\/ \ Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general