Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGTRA.cxx
Go to the documentation of this file.
1// @(#)root/g3d:$Id$
2// Author: Nenad Buncic 19/09/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TGTRA.h"
13#include "TNode.h"
14#include "TMath.h"
15
16
17/** \class TGTRA
18\ingroup g3d
19A general twisted trapezoid.
20
21\image html g3d_gtra.png
22
23The faces perpendicular to z are trapezia
24and their centres are not necessarily on a line parallel to the z axis as the
25TRAP; additionally, the faces may be twisted so that none of their edges are
26parallel. It is a TRAP shape, except that it is twisted in the x-y plane as a
27function of z. The parallel sides perpendicular to the z axis are rotated with
28respect to the x axis by an angle TWIST, which is one of the parameters. The
29shape is defined by the eight corners and is assumed to be constructed of
30straight lines joining points on the boundary of the trapezoidal face at z=-DZ
31to the corresponding points on the face at z=DZ. Divisions are not allowed.
32It has 15 parameters:
33
34 - name: name of the shape
35 - title: shape's title
36 - material: (see TMaterial)
37 - dZ: half-length along the z axis
38 - theta: polar angle of the line joining the centre of the face
39 at -DZ to the centre of the one at +DZ
40 - phi: azimuthal angle of the line joining the centre of
41 the face at -DZ to the centre of the one at +DZ
42 - twist: twist angle of the faces parallel to the x-y plane
43 at z = +/- DZ around an axis parallel to z passing
44 through their centre
45 - h1: half-length along y of the face at -DZ
46 - bl1: half-length along x of the side at -H1 in y of
47 the face at -DZ in z
48 - tl1: half-length along x of the side at +H1 in y of the face
49 at -DZ in z
50 - alpha1: angle with respect to the y axis from the centre of
51 the side at -H1 in y to the centre of the side at
52 +H1 in y of the face at -DZ in z
53 - h2: half-length along y of the face at +DZ
54 - bL2: half-length along x of the side at -H2 in y of the face at
55 +DZ in z
56 - tl2: half-length along x of the side at +H2 in y of the face
57 at +DZ in z
58 - alpha2: angle with respect to the y axis from the centre of the side
59 at -H2 in y to the centre of the side at +H2 in y of the
60 face at +DZ in z
61*/
62
63////////////////////////////////////////////////////////////////////////////////
64/// GTRA shape default constructor.
65
67{
68 fTwist = 0.;
69 fH1 = 0.;
70 fBl1 = 0.;
71 fTl1 = 0.;
72 fAlpha1 = 0.;
73 fH2 = 0.;
74 fBl2 = 0.;
75 fTl2 = 0.;
76 fAlpha2 = 0.;
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// GTRA shape normal constructor
81
82TGTRA::TGTRA (const char *name, const char *title, const char *material, Float_t dz, Float_t theta,
85 : TBRIK (name, title, material, theta, phi, dz)
86{
87 fTwist = twist;
88 fH1 = h1;
89 fBl1 = bl1;
90 fTl1 = tl1;
92 fH2 = h2;
93 fBl2 = bl2;
94 fTl2 = tl2;
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// GTRA shape default destructor
100
102{
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Create GTRA points
107
109{
110 Double_t x, y, dx, dy, dx1, dx2, dz, theta, phi, alpha1, alpha2, twist;
111 const Float_t pi = Float_t (TMath::Pi());
112
113 alpha1 = fAlpha1 * pi/180.0;
114 alpha2 = fAlpha2 * pi/180.0;
115 theta = TBRIK::fDx * pi/180.0;
116 phi = TBRIK::fDy * pi/180.0;
117 twist = fTwist * pi/180.0;
118
119 dx = 2*fDz*TMath::Sin(theta)*TMath::Cos(phi);
120 dy = 2*fDz*TMath::Sin(theta)*TMath::Sin(phi);
121 dz = TBRIK::fDz;
122
125
126 if (points) {
127 points[ 0] = -fBl1; points[ 1] = -fH1; points[ 2] = -dz;
128 points[ 9] = fBl1; points[10] = -fH1; points[11] = -dz;
129 points[ 6] = fTl1+dx1; points[ 7] = fH1; points[ 8] = -dz;
130 points[ 3] = -fTl1+dx1; points[4] = fH1; points[5] = -dz;
131 points[12] = -fBl2+dx; points[13] = -fH2+dy; points[14] = dz;
132 points[21] = fBl2+dx; points[22] = -fH2+dy; points[23] = dz;
133 points[18] = fTl2+dx+dx2; points[19] = fH2+dy; points[20] = dz;
134 points[15] = -fTl2+dx+dx2; points[16] = fH2+dy; points[17] = dz;
135 for (Int_t i = 12; i < 24; i+=3) {
136 x = points[i];
137 y = points[i+1];
140 }
141 }
142}
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition TGX11.cxx:110
A box with faces perpendicular to the axes.
Definition TBRIK.h:26
Float_t fDz
Definition TBRIK.h:31
Float_t fDy
Definition TBRIK.h:30
Float_t fDx
Definition TBRIK.h:29
Float_t fH1
Definition TGTRA.h:31
~TGTRA() override
GTRA shape default destructor.
Definition TGTRA.cxx:101
Float_t fBl1
Definition TGTRA.h:32
Float_t fTwist
Definition TGTRA.h:30
Float_t fAlpha2
Definition TGTRA.h:38
Float_t fAlpha1
Definition TGTRA.h:34
Float_t fBl2
Definition TGTRA.h:36
Float_t fH2
Definition TGTRA.h:35
TGTRA()
GTRA shape default constructor.
Definition TGTRA.cxx:66
void SetPoints(Double_t *points) const override
Create GTRA points.
Definition TGTRA.cxx:108
Float_t fTl1
Definition TGTRA.h:33
Float_t fTl2
Definition TGTRA.h:37
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
TH1F * h1
Definition legend1.C:5
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Definition TMath.h:611