Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TObject.h"
25#include "TString.h"
26#include "TAttLine.h"
27#include "TAtt3D.h"
28
29class TList;
30
31
32class TPolyLine3D : public TObject, public TAttLine, public TAtt3D
33{
34protected:
35 Int_t fN; ///< Number of points
36 Float_t *fP; ///< [3*fN] Array of 3-D coordinates (x,y,z)
37 TString fOption; ///< options
38 Int_t fLastPoint; ///< The index of the last filled point
39
40public:
42 TPolyLine3D(Int_t n, Option_t *option="");
43 TPolyLine3D(Int_t n, Float_t const* p, Option_t *option="");
44 TPolyLine3D(Int_t n, Double_t const* p, Option_t *option="");
45 TPolyLine3D(Int_t n, Float_t const* x, Float_t const* y, Float_t const* z, Option_t *option="");
46 TPolyLine3D(Int_t n, Double_t const* x, Double_t const* y, Double_t const* z, Option_t *option="");
47 TPolyLine3D(const TPolyLine3D &polylin);
48 TPolyLine3D& operator=(const TPolyLine3D &polylin);
49 virtual ~TPolyLine3D();
50
51 virtual void Copy(TObject &polyline) const;
52 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
53 virtual void Draw(Option_t *option="");
54 virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="");
55 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
56 Int_t GetLastPoint() const {return fLastPoint;}
57 Int_t GetN() const {return fN;}
58 Float_t *GetP() const {return fP;}
59 Option_t *GetOption() const {return fOption.Data();}
60 virtual void ls(Option_t *option="") const;
61 virtual Int_t Merge(TCollection *list);
62 virtual void Paint(Option_t *option="");
63 virtual void Print(Option_t *option="") const;
64 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
65 virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z); // *MENU*
66 virtual void SetOption(Option_t *option="") {fOption = option;}
67 virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z); // *MENU*
68 virtual void SetPolyLine(Int_t n, Option_t *option="");
69 virtual void SetPolyLine(Int_t n, Float_t *p, Option_t *option="");
70 virtual void SetPolyLine(Int_t n, Double_t *p, Option_t *option="");
71 virtual Int_t Size() const { return fLastPoint+1;}
72
73 static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax);
74
75 ClassDef(TPolyLine3D,1) //A 3-D polyline
76};
77
78#endif
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
Use this attribute class when an object should have 3D capabilities.
Definition TAtt3D.h:19
Line Attributes class.
Definition TAttLine.h:18
Collection abstract base class.
Definition TCollection.h:63
A doubly linked list.
Definition TList.h:44
Mother of all ROOT objects.
Definition TObject.h:37
A 3-dimensional polyline.
Definition TPolyLine3D.h:33
TPolyLine3D & operator=(const TPolyLine3D &polylin)
assignment operator
TPolyLine3D()
3-D polyline default constructor.
static void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
Draw cube outline with 3d polylines.
virtual void Print(Option_t *option="") const
Dump this 3-D polyline with its attributes on stdout.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save primitive as a C++ statement(s) on output stream.
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
virtual ~TPolyLine3D()
3-D polyline destructor.
virtual Int_t Merge(TCollection *list)
Merge polylines in the collection in this polyline.
virtual void ls(Option_t *option="") const
List this 3-D polyline.
Int_t GetLastPoint() const
Definition TPolyLine3D.h:56
Int_t fLastPoint
The index of the last filled point.
Definition TPolyLine3D.h:38
Int_t fN
Number of points.
Definition TPolyLine3D.h:35
virtual void Paint(Option_t *option="")
Paint a TPolyLine3D.
Float_t * GetP() const
Definition TPolyLine3D.h:58
Int_t GetN() const
Definition TPolyLine3D.h:57
virtual void Copy(TObject &polyline) const
Copy polyline to polyline obj.
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute action corresponding to one event.
virtual Int_t Size() const
Definition TPolyLine3D.h:71
TString fOption
options
Definition TPolyLine3D.h:37
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a 3-D polyline.
virtual void SetOption(Option_t *option="")
Definition TPolyLine3D.h:66
virtual void SetPolyLine(Int_t n, Option_t *option="")
Re-initialize polyline with n points (0,0,0).
virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="")
Draw 3-D polyline with new coordinates.
Option_t * GetOption() const
Definition TPolyLine3D.h:59
Float_t * fP
[3*fN] Array of 3-D coordinates (x,y,z)
Definition TPolyLine3D.h:36
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
th1 Draw()