Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPARA.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 "TPARA.h"
13#include "TNode.h"
14#include "TMath.h"
15
16
17/** \class TPARA
18\ingroup g3d
19A parallelepiped.
20
21\image html g3d_para.png
22It has 9 parameters:
23
24 - name: name of the shape
25 - title: shape's title
26 - material: (see TMaterial)
27 - dx: half-length in x
28 - dy: half-length in y
29 - dz: half-length in z
30 - alpha: angle formed by the y axis and by the plane joining the
31 centre of the faces parallel to the z-x plane at -DY and +DY
32 - theta: polar angle of the line joining the centres of the faces
33 at -DZ and +DZ in z
34 - phi: azimuthal angle of the line joining the centres of the
35 faces at -DZ and +DZ in z
36*/
37
38////////////////////////////////////////////////////////////////////////////////
39/// PARA shape default constructor
40
42{
43 fAlpha = 0.;
44 fTheta = 0.;
45 fPhi = 0.;
46}
47
48////////////////////////////////////////////////////////////////////////////////
49/// PARA shape normal constructor
50
51TPARA::TPARA(const char *name, const char *title, const char *material, Float_t dx, Float_t dy, Float_t dz,
52 Float_t alpha, Float_t theta, Float_t phi) : TBRIK(name, title,material, dx, dy, dz)
53{
54 fAlpha = alpha;
55 fTheta = theta;
56 fPhi = phi;
57}
58
59////////////////////////////////////////////////////////////////////////////////
60/// PARA shape default destructor
61
63{
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Create PARA points
68
70{
71 if (!points) return;
72 Float_t dx, dy, dz, theta, phi, alpha;
73 const Float_t pi = Float_t (TMath::Pi());
74
75 alpha = fAlpha * pi/180.0;
76 theta = fTheta * pi/180.0;
77 phi = fPhi * pi/180.0;
78
79 dx = TBRIK::fDx;
80 dy = TBRIK::fDy;
81 dz = TBRIK::fDz;
82
83 // Parallelepiped change angles to tangents (by Pavel Nevski 12/04/99)
84 Double_t txy = TMath::Tan(alpha);
85 Double_t tth = TMath::Tan(theta);
88
89 *points++ = -dz*txz-txy*dy-dx ; *points++ = -dy-dz*tyz ; *points++ = -dz;
90 *points++ = -dz*txz+txy*dy-dx ; *points++ = +dy-dz*tyz ; *points++ = -dz; //3
91 *points++ = -dz*txz+txy*dy+dx ; *points++ = +dy-dz*tyz ; *points++ = -dz;
92 *points++ = -dz*txz-txy*dy+dx ; *points++ = -dy-dz*tyz ; *points++ = -dz;//1
93 *points++ = +dz*txz-txy*dy-dx ; *points++ = -dy+dz*tyz ; *points++ = +dz;
94 *points++ = +dz*txz+txy*dy-dx ; *points++ = +dy+dz*tyz ; *points++ = +dz;//7
95 *points++ = +dz*txz+txy*dy+dx ; *points++ = +dy+dz*tyz ; *points++ = +dz;
96 *points++ = +dz*txz-txy*dy+dx ; *points++ = -dy+dz*tyz ; *points++ = +dz;//5
97}
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 fAlpha
Definition TPARA.h:32
Float_t fTheta
Definition TPARA.h:33
~TPARA() override
PARA shape default destructor.
Definition TPARA.cxx:62
void SetPoints(Double_t *points) const override
Create PARA points.
Definition TPARA.cxx:69
TPARA()
PARA shape default constructor.
Definition TPARA.cxx:41
Float_t fPhi
Definition TPARA.h:34
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