Message: rotation matrix problems Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None rotation matrix problems 

Forum: Geometry
Date: 28 Jun, 2011
From: Jason Maldonis <Jason Maldonis>

--000e0ce02aaa3725a904a6ccc5b0
Content-Type: text/plain; charset=ISO-8859-1

Hello all,

I am having a dire problem with my rotation matrices... I swear it should be
working but it doesn't. The objective is to produce a cylinder made of
smaller boxes -- so say there are 20 boxes: now make them into a cylinder.
I'm using a for loop.

The positioning works out just fine, they appear in a circle. However, I
want to orient them so that one face of the box faces toward the center.
Please let me know if you have any ideas on how to get the correct
orientation.

Here is my code: numOfReps is the number of boxes I am placing.

 deltha_Angle = (G4double) 360.0/numOfReps*deg;
 for(G4double i = 0; i < numOfReps; i++)
 {

new_angle = deltha_Angle*i;
 x_coor = radius*cos(new_angle);
y_coor = radius*sin(new_angle);

 G4cout << "  Rotation Angle " << i << " is " << new_angle/deg << "." <<
G4endl;

rm = new G4RotationMatrix();
rm->rotateX(new_angle);
new G4PVPlacement(rm,
 G4ThreeVector(0,x_coor,y_coor),
logic,
 "", //name
 momslogic,
false, 0);
}

Thanks,
Jason

--000e0ce02aaa3725a904a6ccc5b0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello all,<div><br></div><div>I am having a dire problem with my rotation m=
atrices... I swear it should be working but it doesn&#39;t. The objective i=
s to produce a cylinder made of smaller boxes -- so say there are 20 boxes:=
 now make them into a cylinder. I&#39;m using a for loop.</div>

<div><br></div><div>The positioning works out just fine, they appear in a c=
ircle. However, I want to orient them so that one face of the box faces tow=
ard the center. Please let me know if you have any ideas on how to get the =
correct orientation.=A0</div>

<div><br></div><div>Here is my code: numOfReps is the number of boxes I am =
placing.</div><div><br></div><div>
<div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
deltha_Angle =3D (G4double) 360.0/numOfReps*deg;</div><div><span class=3D"A=
pple-tab-span" style=3D"white-space:pre"> </span></div><div><span class=3D"=
Apple-tab-span" style=3D"white-space:pre"> </span>for(G4double i =3D 0; i &=
lt; numOfReps; i++)</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</di=
v><div><br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:p=
re">  </span>new_angle =3D deltha_Angle*i;</div><div><span class=3D"Apple-t=
ab-span" style=3D"white-space:pre">  </span></div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">  </span>x_co=
or =3D radius*cos(new_angle);</div><div><span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre">  </span>y_coor =3D radius*sin(new_angle);</div><div>=
<br></div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">  </span>G4co=
ut &lt;&lt; &quot; =A0Rotation Angle &quot; &lt;&lt; i &lt;&lt; &quot; is &=
quot; &lt;&lt; new_angle/deg &lt;&lt; &quot;.&quot; &lt;&lt; G4endl;</div><=
div>

<br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">  <=
/span>rm =3D new G4RotationMatrix();</div><div><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre">  </span>rm-&gt;rotateX(new_angle);</div><div>=
<span class=3D"Apple-tab-span" style=3D"white-space:pre">  </span>new G4PVP=
lacement(rm,</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">       </span=
>G4ThreeVector(0,x_coor,y_coor),</div><div><span class=3D"Apple-tab-span" s=
tyle=3D"white-space:pre">       </span>logic,</div><div><span class=3D"Appl=
e-tab-span" style=3D"white-space:pre">       </span>=A0&quot;&quot;,<span c=
lass=3D"Apple-tab-span" style=3D"white-space:pre">  </span>//name</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">       </span=
>momslogic,</div><div><span class=3D"Apple-tab-span" style=3D"white-space:p=
re">       </span>false, 0);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>}</div>

</div></div><div><br></div><div>Thanks,</div><div>Jason</div>

--000e0ce02aaa3725a904a6ccc5b0--

 Add Message Add Message
to: "rotation matrix problems"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]