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{0}; ///< Number of points
36 Float_t *fP{nullptr}; ///< [3*fN] Array of 3-D coordinates (x,y,z)
37 TString fOption; ///< options
38 Int_t fLastPoint{-1}; ///< The index of the last filled point
39
40public:
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 ~TPolyLine3D() override;
50
51 void Copy(TObject &polyline) const override;
52 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
53 void Draw(Option_t *option="") override;
54 virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="");
55 void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
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 override { return fOption.Data(); }
60 void ls(Option_t *option="") const override;
61 virtual Int_t Merge(TCollection *list);
62 void Paint(Option_t *option="") override;
63 void Print(Option_t *option="") const override;
64 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
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 ClassDefOverride(TPolyLine3D,1) //A 3-D polyline
76};
77
78#endif
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
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:65
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
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.
Option_t * GetOption() const override
Definition TPolyLine3D.h:59
void Paint(Option_t *option="") override
Paint a TPolyLine3D.
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 Int_t Merge(TCollection *list)
Merge polylines in the collection in this 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
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream.
~TPolyLine3D() override
3-D polyline destructor.
Float_t * GetP() const
Definition TPolyLine3D.h:58
Int_t GetN() const
Definition TPolyLine3D.h:57
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
virtual Int_t Size() const
Definition TPolyLine3D.h:71
TString fOption
options
Definition TPolyLine3D.h:37
void ls(Option_t *option="") const override
List this 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).
void Copy(TObject &polyline) const override
Copy polyline to polyline obj.
virtual void DrawPolyLine(Int_t n, Float_t *p, Option_t *option="")
Draw 3-D polyline with new coordinates.
void Print(Option_t *option="") const override
Dump this 3-D polyline with its attributes on stdout.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute distance from point px,py to a 3-D polyline.
Float_t * fP
[3*fN] Array of 3-D coordinates (x,y,z)
Definition TPolyLine3D.h:36
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
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()