Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveArrow.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 "TEveArrow.h"
13 #include "TEveTrans.h"
14 
15 
16 /** \class TEveArrow
17 \ingroup TEve
18 Class used for display of a thick arrow.
19 */
20 
21 ClassImp(TEveArrow);
22 
23 ////////////////////////////////////////////////////////////////////////////////
24 
25 TEveArrow::TEveArrow(Float_t xVec, Float_t yVec, Float_t zVec,
26  Float_t xOrg, Float_t yOrg, Float_t zOrg):
27  TEveElement(fColor),
28  TNamed("TEveArrow", ""),
29  TAtt3D(), TAttBBox(),
30 
31  fTubeR(0.02), fConeR(0.04), fConeL(0.08),
32  fOrigin(xOrg, yOrg, zOrg), fVector(xVec, yVec, zVec),
33  fDrawQuality(10)
34 {
35  // Constructor.
36  // Org - starting point.
37  // Vec - vector from start to end of the arrow.
38 
39  fCanEditMainColor = kTRUE;
40  fCanEditMainTransparency = kTRUE;
41 }
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Compute bounding-box of the arrow.
45 
46 void TEveArrow::ComputeBBox()
47 {
48  TEveVector a, b;
49  fVector.OrthoNormBase(a, b);
50  Float_t r = fVector.Mag() * TMath::Max(fTubeR, fConeR);
51  a *= r; b *= r;
52 
53  TEveVector end(fOrigin + fVector);
54 
55  BBoxInit();
56  BBoxCheckPoint(fOrigin + a + b);
57  BBoxCheckPoint(fOrigin + a - b);
58  BBoxCheckPoint(fOrigin - a - b);
59  BBoxCheckPoint(fOrigin - a + b);
60  BBoxCheckPoint(end + a + b);
61  BBoxCheckPoint(end + a - b);
62  BBoxCheckPoint(end - a - b);
63  BBoxCheckPoint(end - a + b);
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// Paint object.
68 /// This is for direct rendering (using TEveArrowGL class).
69 
70 void TEveArrow::Paint(Option_t*)
71 {
72  PaintStandard(this);
73 }