File indexing completed on 2025-08-05 08:11:59
0001
0002
0003
0004 TPolyLine* TraceBox( float angle, float center_z, float center_x, float length, float aperture_radius, float outer_radius )
0005 {
0006
0007 TVector3* vcenter = new TVector3( center_z,
0008 center_x,
0009 0.0 );
0010
0011
0012 const unsigned npts = 5;
0013 TObjArray a;
0014
0015
0016 a.AddLast( new TVector3( 0.0 - ( length / 2. ),
0017 0.0 + outer_radius,
0018 0.0 ) );
0019
0020 a.AddLast( new TVector3( 0.0 + ( length / 2. ),
0021 0.0 + outer_radius,
0022 0.0 ) );
0023
0024 a.AddLast( new TVector3( 0.0 + ( length / 2. ),
0025 0.0 + aperture_radius,
0026 0.0 ) );
0027
0028 a.AddLast( new TVector3( 0.0 - ( length / 2. ),
0029 0.0 + aperture_radius,
0030 0.0 ) );
0031
0032 a.AddLast( new TVector3( 0.0 - ( length / 2. ),
0033 0.0 + outer_radius,
0034 0.0 ) );
0035
0036
0037 for ( int i = 0; i < npts; i++ )
0038 {
0039
0040 float rotated_x = ( (TVector3*)a[i] )->X() * cos( angle ) - ( (TVector3*)a[i] )->Y() * sin( angle );
0041 float rotated_y = ( (TVector3*)a[i] )->X() * sin( angle ) + ( (TVector3*)a[i] )->Y() * cos( angle );
0042
0043
0044 rotated_x += center_z;
0045 rotated_y += center_x;
0046
0047
0048 ( (TVector3*)a[i] )->SetX( rotated_x );
0049 ( (TVector3*)a[i] )->SetY( rotated_y );
0050 }
0051
0052
0053 float xarr[ npts ];
0054 float yarr[ npts ];
0055
0056 for ( int i = 0; i < npts; i++ )
0057 {
0058 xarr[i] = ( (TVector3*)a[i] )->X();
0059 yarr[i] = ( (TVector3*)a[i] )->Y();
0060 }
0061
0062
0063 return new TPolyLine(npts, xarr, yarr);
0064 }