// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, 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 "TEveArrow.h"
#include "TEveTrans.h"


//______________________________________________________________________________
//
// TEveElement class used for display of a thick arrow.

ClassImp(TEveArrow);

//______________________________________________________________________________
TEveArrow::TEveArrow(Float_t xVec, Float_t yVec, Float_t zVec,
                     Float_t xOrg, Float_t yOrg, Float_t zOrg):
   TEveElement(fColor),
   TNamed("TEveArrow", ""),
   TAtt3D(), TAttBBox(),

   fTubeR(0.02), fConeR(0.04), fConeL(0.08),
   fOrigin(xOrg, yOrg, zOrg), fVector(xVec, yVec, zVec),
   fDrawQuality(10)
{
   // Constructor.
   // Org - starting point.
   // Vec - vector from start to end of the arrow.

   fCanEditMainColor        = kTRUE;
   fCanEditMainTransparency = kTRUE;
}

//______________________________________________________________________________
void TEveArrow::ComputeBBox()
{
   // Compute bounding-box of the arrow.

   TEveVector a, b;
   fVector.OrthoNormBase(a, b);
   Float_t r = TMath::Max(fTubeR, fConeR);
   a *= r; b *= r;

   TEveVector end(fOrigin + fVector);

   BBoxZero();
   BBoxCheckPoint(fOrigin + a + b);
   BBoxCheckPoint(fOrigin + a - b);
   BBoxCheckPoint(fOrigin - a - b);
   BBoxCheckPoint(fOrigin - a + b);
   BBoxCheckPoint(end + a + b);
   BBoxCheckPoint(end + a - b);
   BBoxCheckPoint(end - a - b);
   BBoxCheckPoint(end - a + b);
}

//______________________________________________________________________________
void TEveArrow::Paint(Option_t*)
{
   // Paint object.
   // This is for direct rendering (using TEveArrowGL class).

   PaintStandard(this);
}
 TEveArrow.cxx:1
 TEveArrow.cxx:2
 TEveArrow.cxx:3
 TEveArrow.cxx:4
 TEveArrow.cxx:5
 TEveArrow.cxx:6
 TEveArrow.cxx:7
 TEveArrow.cxx:8
 TEveArrow.cxx:9
 TEveArrow.cxx:10
 TEveArrow.cxx:11
 TEveArrow.cxx:12
 TEveArrow.cxx:13
 TEveArrow.cxx:14
 TEveArrow.cxx:15
 TEveArrow.cxx:16
 TEveArrow.cxx:17
 TEveArrow.cxx:18
 TEveArrow.cxx:19
 TEveArrow.cxx:20
 TEveArrow.cxx:21
 TEveArrow.cxx:22
 TEveArrow.cxx:23
 TEveArrow.cxx:24
 TEveArrow.cxx:25
 TEveArrow.cxx:26
 TEveArrow.cxx:27
 TEveArrow.cxx:28
 TEveArrow.cxx:29
 TEveArrow.cxx:30
 TEveArrow.cxx:31
 TEveArrow.cxx:32
 TEveArrow.cxx:33
 TEveArrow.cxx:34
 TEveArrow.cxx:35
 TEveArrow.cxx:36
 TEveArrow.cxx:37
 TEveArrow.cxx:38
 TEveArrow.cxx:39
 TEveArrow.cxx:40
 TEveArrow.cxx:41
 TEveArrow.cxx:42
 TEveArrow.cxx:43
 TEveArrow.cxx:44
 TEveArrow.cxx:45
 TEveArrow.cxx:46
 TEveArrow.cxx:47
 TEveArrow.cxx:48
 TEveArrow.cxx:49
 TEveArrow.cxx:50
 TEveArrow.cxx:51
 TEveArrow.cxx:52
 TEveArrow.cxx:53
 TEveArrow.cxx:54
 TEveArrow.cxx:55
 TEveArrow.cxx:56
 TEveArrow.cxx:57
 TEveArrow.cxx:58
 TEveArrow.cxx:59
 TEveArrow.cxx:60
 TEveArrow.cxx:61
 TEveArrow.cxx:62
 TEveArrow.cxx:63
 TEveArrow.cxx:64
 TEveArrow.cxx:65
 TEveArrow.cxx:66
 TEveArrow.cxx:67
 TEveArrow.cxx:68
 TEveArrow.cxx:69
 TEveArrow.cxx:70
 TEveArrow.cxx:71