forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEveArrow.cxx
73 lines (58 loc) · 2.1 KB
/
TEveArrow.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// @(#)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"
/** \class TEveArrow
\ingroup TEve
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;
}
////////////////////////////////////////////////////////////////////////////////
/// Compute bounding-box of the arrow.
void TEveArrow::ComputeBBox()
{
TEveVector a, b;
fVector.OrthoNormBase(a, b);
Float_t r = fVector.Mag() * TMath::Max(fTubeR, fConeR);
a *= r; b *= r;
TEveVector end(fOrigin + fVector);
BBoxInit();
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);
}
////////////////////////////////////////////////////////////////////////////////
/// Paint object.
/// This is for direct rendering (using TEveArrowGL class).
void TEveArrow::Paint(Option_t*)
{
PaintStandard(this);
}