ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TPolyLine3D.h
Go to the documentation of this file.
1 // @(#)root/g3d:$Id$
2 // Author: Nenad Buncic 17/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 #ifndef ROOT_TPolyLine3D
13 #define ROOT_TPolyLine3D
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TPolyLine3D //
19 // //
20 // A 3-D polyline. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TObject
25 #include "TObject.h"
26 #endif
27 #ifndef ROOT_TList
28 #include "TList.h"
29 #endif
30 #ifndef ROOT_TTString
31 #include "TString.h"
32 #endif
33 #ifndef ROOT_TAttLine
34 #include "TAttLine.h"
35 #endif
36 #ifndef ROOT_TAtt3D
37 #include "TAtt3D.h"
38 #endif
39 
40 
41 class TPolyLine3D : public TObject, public TAttLine, public TAtt3D
42 {
43 protected:
44  Int_t fN; //Number of points
45  Float_t *fP; //[3*fN] Array of 3-D coordinates (x,y,z)
46  TString fOption; //options
47  Int_t fLastPoint; //The index of the last filled point
48 
49 public:
50  TPolyLine3D();
51  TPolyLine3D(Int_t n, Option_t *option="");
52  TPolyLine3D(Int_t n, Float_t *p, Option_t *option="");
53  TPolyLine3D(Int_t n, Double_t *p, Option_t *option="");
54  TPolyLine3D(Int_t n, Float_t *x, Float_t *y, Float_t *z, Option_t *option="");
55  TPolyLine3D(Int_t n, Double_t *x, Double_t *y, Double_t *z, Option_t *option="");
56  TPolyLine3D(const TPolyLine3D &polylin);
57  TPolyLine3D& operator=(const TPolyLine3D &polylin);
58  virtual ~TPolyLine3D();
59 
60  virtual void Copy(TObject &polyline) const;
62  virtual void Draw(Option_t *option="");
63  virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="");
64  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
65  Int_t GetLastPoint() const {return fLastPoint;}
66  Int_t GetN() const {return fN;}
67  Float_t *GetP() const {return fP;}
68  Option_t *GetOption() const {return fOption.Data();}
69  virtual void ls(Option_t *option="") const;
70  virtual Int_t Merge(TCollection *list);
71  virtual void Paint(Option_t *option="");
72  virtual void Print(Option_t *option="") const;
73  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
74  virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z); // *MENU*
75  virtual void SetOption(Option_t *option="") {fOption = option;}
76  virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
77  virtual void SetPolyLine(Int_t n, Option_t *option="");
78  virtual void SetPolyLine(Int_t n, Float_t *p, Option_t *option="");
79  virtual void SetPolyLine(Int_t n, Double_t *p, Option_t *option="");
80  virtual Int_t Size() const { return fLastPoint+1;}
81 
82  static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax);
83 
84  ClassDef(TPolyLine3D,1) //A 3-D polyline
85 };
86 
87 #endif
Option_t * GetOption() const
Definition: TPolyLine3D.h:68
TPolyLine3D()
3-D polyline default constructor.
Definition: TPolyLine3D.cxx:92
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
Float_t * fP
Definition: TPolyLine3D.h:45
float Float_t
Definition: RtypesCore.h:53
Int_t GetN() const
Definition: TPolyLine3D.h:66
virtual void SetPolyLine(Int_t n, Option_t *option="")
Re-initialize polyline with n points (0,0,0).
const char Option_t
Definition: RtypesCore.h:62
Float_t * GetP() const
Definition: TPolyLine3D.h:67
Use this attribute class when an object should have 3D capabilities.
Definition: TAtt3D.h:29
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
A 3-dimensional polyline.
Definition: TPolyLine3D.h:41
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
virtual Int_t Size() const
Definition: TPolyLine3D.h:80
Float_t py
Definition: hprod.C:33
virtual void Print(Option_t *option="") const
Dump this 3-D polyline with its attributes on stdout.
const char * Data() const
Definition: TString.h:349
Double_t x[n]
Definition: legend1.C:17
virtual ~TPolyLine3D()
3-D polyline destructor.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a 3-D polyline.
Int_t GetLastPoint() const
Definition: TPolyLine3D.h:65
ClassDef(TAttLine, 2)
Float_t z[5]
Definition: Ifit.C:16
char * out
Definition: TBase64.cxx:29
A doubly linked list.
Definition: TList.h:47
static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
Draw cube outline with 3d polylines.
TString fOption
Definition: TPolyLine3D.h:46
Collection abstract base class.
Definition: TCollection.h:48
TPolyLine3D & operator=(const TPolyLine3D &polylin)
assignment operator
virtual void SetOption(Option_t *option="")
Definition: TPolyLine3D.h:75
virtual void Draw(Option_t *option="")
Draw this 3-D polyline with its current attributes.
virtual void Copy(TObject &polyline) const
Copy polyline to polyline obj.
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
double Double_t
Definition: RtypesCore.h:55
Int_t fLastPoint
Definition: TPolyLine3D.h:47
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
Double_t y[n]
Definition: legend1.C:17
virtual void Paint(Option_t *option="")
Paint a TPolyLine3D.
virtual void ls(Option_t *option="") const
List this 3-D polyline.
Mother of all ROOT objects.
Definition: TObject.h:58
Float_t px
Definition: hprod.C:33
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream.
virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="")
Draw 3-D polyline with new coordinates.
const Int_t n
Definition: legend1.C:16
Line Attributes class.
Definition: TAttLine.h:32