    // @(#)root/g3d:$Name:  $:$Id: TPARA.cxx,v 1.5 2005/03/09 18:19:26 brun Exp $
    // Author: Nenad Buncic   19/09/95

    /*************************************************************************
     * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
     * All rights reserved.                                                  *
     *                                                                       *
     * For the licensing terms see $ROOTSYS/LICENSE.                         *
     * For the list of contributors see $ROOTSYS/README/CREDITS.             *
     *************************************************************************/

    #include "TPARA.h"
    #include "TNode.h"

    ClassImp(TPARA)

    //______________________________________________________________________________
    //

    // PARA is a parallelepiped. It has 9 parameters:
    //
    //     - name       name of the shape
    //     - title      shape's title
    //     - material  (see TMaterial)
    //     - dx         half-length in x
    //     - dy         half-length in y
    //     - dz         half-length in z
    //     - alpha      angle formed by the y axis and by the plane joining the
    //                  centre of the faces parallel to the z-x plane at -DY and +DY
    //     - theta      polar angle of the line joining the centres of the faces
    //                  at -DZ and +DZ in z
    //     - phi        azimuthal angle of the line joining the centres of the
    //                  faces at -DZ and +DZ in z

    //______________________________________________________________________________
     TPARA::TPARA()
    {
       // PARA shape default constructor
    }

    //______________________________________________________________________________
     TPARA::TPARA(const char *name, const char *title, const char *material, Float_t dx, Float_t dy, Float_t dz,
                 Float_t alpha, Float_t theta, Float_t phi) : TBRIK(name, title,material, dx, dy, dz)
    {
       // PARA shape normal constructor

       fAlpha = alpha;
       fTheta = theta;
       fPhi   = phi;
    }

    //______________________________________________________________________________
     TPARA::~TPARA()
    {
       // PARA shape default destructor
    }

    //______________________________________________________________________________
     void TPARA::SetPoints(Double_t *points) const
    {
       // Create PARA points

       if (!points) return;
       Float_t dx, dy, dz, theta, phi, alpha;
       const Float_t PI = Float_t (TMath::Pi());

       alpha = fAlpha * PI/180.0;
       theta = fTheta * PI/180.0;
       phi   = fPhi   * PI/180.0;

       dx = TBRIK::fDx;
       dy = TBRIK::fDy;
       dz = TBRIK::fDz;

       // Parallelepiped change angles to tangents (by Pavel Nevski 12/04/99)
       Double_t TXY = TMath::Tan(alpha);
       Double_t TTH = TMath::Tan(theta);
       Double_t TXZ = TTH*TMath::Cos(phi);
       Double_t TYZ = TTH*TMath::Sin(phi);

       *points++ = -dz*TXZ-TXY*dy-dx ; *points++ = -dy-dz*TYZ ; *points++ = -dz;
       *points++ = -dz*TXZ+TXY*dy-dx ; *points++ = +dy-dz*TYZ ; *points++ = -dz; //3
       *points++ = -dz*TXZ+TXY*dy+dx ; *points++ = +dy-dz*TYZ ; *points++ = -dz;
       *points++ = -dz*TXZ-TXY*dy+dx ; *points++ = -dy-dz*TYZ ; *points++ = -dz;//1
       *points++ = +dz*TXZ-TXY*dy-dx ; *points++ = -dy+dz*TYZ ; *points++ = +dz;
       *points++ = +dz*TXZ+TXY*dy-dx ; *points++ = +dy+dz*TYZ ; *points++ = +dz;//7
       *points++ = +dz*TXZ+TXY*dy+dx ; *points++ = +dy+dz*TYZ ; *points++ = +dz;
       *points++ = +dz*TXZ-TXY*dy+dx ; *points++ = -dy+dz*TYZ ; *points++ = +dz;//5
    }