TGeoXtru.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TGeoXtru.h 21425 2007-12-17 15:59:27Z brun $
00002 // Author: Mihaela Gheata   24/01/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGeoXtru
00013 #define ROOT_TGeoXtru
00014 
00015 #ifndef ROOT_TGeoBBox
00016 #include "TGeoBBox.h"
00017 #endif
00018   
00019 class TGeoPolygon;
00020 
00021 ////////////////////////////////////////////////////////////////////////////
00022 //                                                                        //
00023 // TGeoXtru - An extrusion with fixed outline shape in x-y and a sequence //
00024 //   of z extents (segments).  The overall scale of the outline scales    //
00025 //   linearly between z points and the center can have an x-y offset.     //
00026 //                                                                        //
00027 //   Based on the initial implementation of R. Hatcher                    //
00028 //                                                                        //
00029 ////////////////////////////////////////////////////////////////////////////
00030 
00031 class TGeoXtru : public TGeoBBox
00032 {
00033 protected:
00034    // data members
00035    Int_t                 fNvert; // number of vertices of the 2D polygon (at least 3)
00036    Int_t                 fNz;    // number of z planes (at least two)
00037    Double_t              fZcurrent; // current Z position
00038    TGeoPolygon          *fPoly;  // polygon defining section shape
00039    Double_t             *fX;     //[fNvert] X positions for polygon vertices
00040    Double_t             *fY;     //[fNvert] Y positions for polygon vertices
00041    Double_t             *fXc;    //[fNvert] current X positions for polygon vertices
00042    Double_t             *fYc;    //[fNvert] current Y positions for polygon vertices
00043    Double_t             *fZ;     //[fNz] array of Z planes positions 
00044    Double_t             *fScale; //[fNz] array of scale factors (for each Z)
00045    Double_t             *fX0;    //[fNz] array of X offsets (for each Z)
00046    Double_t             *fY0;    //[fNz] array of Y offsets (for each Z)
00047    Int_t                 fSeg;   // !current segment [0,fNvert-1]
00048    Int_t                 fIz;    // !current z plane [0,fNz-1]
00049 
00050    TGeoXtru(const TGeoXtru&); 
00051    TGeoXtru& operator=(const TGeoXtru&);
00052 
00053    // methods
00054    Double_t              DistToPlane(Double_t *point, Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const;
00055    void                  GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const;
00056    void                  GetPlaneNormal(const Double_t *vert, Double_t *norm) const;
00057    Bool_t                IsPointInsidePlane(Double_t *point, Double_t *vert, Double_t *norm) const;
00058    Double_t              SafetyToSector(Double_t *point, Int_t iz, Double_t safmin);
00059    void                  SetIz(Int_t iz) {fIz = iz;}
00060    void                  SetSeg(Int_t iseg) {fSeg = iseg;}
00061 
00062 public:
00063    // constructors
00064    TGeoXtru();
00065    TGeoXtru(Int_t nz);
00066    TGeoXtru(Double_t *param);
00067    // destructor
00068    virtual ~TGeoXtru();
00069    // methods
00070    virtual Double_t      Capacity() const;
00071    virtual void          ComputeBBox();
00072    virtual void          ComputeNormal(Double_t *point, Double_t *dir, Double_t *norm);
00073    virtual Bool_t        Contains(Double_t *point) const;
00074    Bool_t                DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv);
00075    virtual void          DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.);
00076    virtual Double_t      DistFromInside(Double_t *point, Double_t *dir, Int_t iact=1, 
00077                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00078    virtual Double_t      DistFromOutside(Double_t *point, Double_t *dir, Int_t iact=1, 
00079                                    Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
00080    virtual Int_t         DistancetoPrimitive(Int_t px, Int_t py);
00081    virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
00082 //   virtual Int_t         GetByteCount() const {return 60+12*fNz;}
00083    Int_t                 GetNz() const    {return fNz;}
00084    Int_t                 GetNvert() const {return fNvert;}
00085    Double_t              GetX(Int_t i) const {return (i<fNvert&&i>-1 &&fX!=0) ? fX[i] : -1.0E10;}
00086    Double_t              GetY(Int_t i) const {return (i<fNvert&&i>-1 &&fY!=0) ? fY[i] : -1.0E10;}
00087    Double_t              GetXOffset(Int_t i) const {return (i<fNz&&i>-1 && fX0!=0) ? fX0[i] : 0.0;}
00088    Double_t              GetYOffset(Int_t i) const {return (i<fNz&&i>-1 && fY0!=0) ? fY0[i] : 0.0;}
00089    Double_t              GetScale(Int_t i) const {return (i<fNz&&i>-1 && fScale!=0) ? fScale[i] : 1.0;}
00090    Double_t             *GetZ() const     {return fZ;}
00091    Double_t              GetZ(Int_t ipl) const;
00092    virtual TGeoShape    *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const {return 0;}
00093    virtual void          GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
00094    virtual Int_t         GetNmeshVertices() const;
00095    virtual void          InspectShape() const;
00096    virtual TBuffer3D    *MakeBuffer3D() const;
00097    Double_t             &Z(Int_t ipl) {return fZ[ipl];}
00098    virtual Double_t      Safety(Double_t *point, Bool_t in=kTRUE) const;
00099    virtual void          SavePrimitive(ostream &out, Option_t *option = "");
00100    void                  SetCurrentZ(Double_t z, Int_t iz);
00101    void                  SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale);
00102    virtual void          SetDimensions(Double_t *param);
00103    virtual void          SetPoints(Double_t *points) const;
00104    virtual void          SetPoints(Float_t *points) const;
00105    virtual void          SetSegsAndPols(TBuffer3D &buff) const;
00106    virtual void          Sizeof3D() const;
00107 
00108    ClassDef(TGeoXtru, 2)         // extruded polygon class 
00109 };
00110 
00111 #endif

Generated on Tue Jul 5 14:12:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1