library: libGraf3d
#include "TPolyLine3D.h"

TPolyLine3D


class description - source file - inheritance tree (.pdf)

class TPolyLine3D : public TObject, public TAttLine, public TAtt3D

Inheritance Chart:
TObject
TAttLine
TAtt3D
<-
TPolyLine3D
<-
THelix

    public:
TPolyLine3D() TPolyLine3D(Int_t n, Option_t* option = "") TPolyLine3D(Int_t n, Float_t* p, Option_t* option = "") TPolyLine3D(Int_t n, Double_t* p, Option_t* option = "") TPolyLine3D(Int_t n, Float_t* x, Float_t* y, Float_t* z, Option_t* option = "") TPolyLine3D(Int_t n, Double_t* x, Double_t* y, Double_t* z, Option_t* option = "") TPolyLine3D(const TPolyLine3D& polylin) virtual ~TPolyLine3D() static TClass* Class() virtual void Copy(TObject& polyline) const virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) virtual void Draw(Option_t* option = "") static void DrawOutlineCube(TList* outline, Double_t* rmin, Double_t* rmax) virtual void DrawPolyLine(Int_t n, Float_t* p, Option_t* option = "") virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) Int_t GetLastPoint() const Int_t GetN() const virtual Option_t* GetOption() const Float_t* GetP() const virtual TClass* IsA() const virtual void ls(Option_t* option = "") const virtual Int_t Merge(TCollection* list) TPolyLine3D& operator=(const TPolyLine3D&) virtual void Paint(Option_t* option = "") virtual void Print(Option_t* option = "") const virtual void SavePrimitive(ofstream& out, Option_t* option) virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z) virtual void SetOption(Option_t* option = "") virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z) virtual void SetPolyLine(Int_t n, Option_t* option = "") virtual void SetPolyLine(Int_t n, Float_t* p, Option_t* option = "") virtual void SetPolyLine(Int_t n, Double_t* p, Option_t* option = "") virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Size() const virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
Int_t fN Number of points Float_t* fP [3*fN] Array of 3-D coordinates (x,y,z) TString fOption options UInt_t fGLList !The list number for OpenGL view Int_t fLastPoint The index of the last filled point

Class Description

 PolyLine3D is a 3-dimensional polyline. It has 4 different constructors.

   First one, without any parameters TPolyLine3D(), we call 'default
 constructor' and it's used in a case that just an initialisation is
 needed (i.e. pointer declaration).

       Example:
                 TPolyLine3D *pl1 = new TPolyLine3D;


   Second one is 'normal constructor' with, usually, one parameter
 n (number of points), and it just allocates a space for the points.

       Example:
                 TPolyLine3D pl1(150);


   Third one allocates a space for the points, and also makes
 initialisation from the given array.

       Example:
                 TPolyLine3D pl1(150, pointerToAnArray);


   Fourth one is, almost, similar to the constructor above, except
 initialisation is provided with three independent arrays (array of
 x coordinates, y coordinates and z coordinates).

       Example:
                 TPolyLine3D pl1(150, xArray, yArray, zArray);

 Example:
   void pl3() {
      TCanvas *c1 = new TCanvas("c1");
      TView *view = new TView(1);
      view->SetRange(0,0,0,2,2,2);
      const Int_t n = 100;
      TPolyLine3D *l = new TPolyLine3D(n);
      for (Int_t i=0;i<n;i++) {
         Double_t x = 2*gRandom->Rndm();
         Double_t y = 2*gRandom->Rndm();
         Double_t z = 2*gRandom->Rndm();
         l->SetPoint(i,x,y,z);
      }
      l->Draw();
   }

TPolyLine3D()
 3-D polyline default constructor.

TPolyLine3D(Int_t n, Option_t *option)
 3-D polyline normal constructor with initialization to 0.
 If n < 0 the default size (2 points) is set.

TPolyLine3D(Int_t n, Float_t *p, Option_t *option)
 3-D polyline normal constructor. Polyline is intialized with p.
 If n < 0 the default size (2 points) is set.

TPolyLine3D(Int_t n, Double_t *p, Option_t *option)
 3-D polyline normal constructor. Polyline is initialized with p
 (cast to float). If n < 0 the default size (2 points) is set.

TPolyLine3D(Int_t n, Float_t *x, Float_t *y, Float_t *z, Option_t *option)
 3-D polyline normal constructor. Polyline is initialized withe the
 x, y ,z arrays. If n < 0 the default size (2 points) is set.

TPolyLine3D(Int_t n, Double_t *x, Double_t *y, Double_t *z, Option_t *option)
 3-D polyline normal constructor. Polyline is initialized withe the
 x, y, z arrays (which are cast to float).
 If n < 0 the default size (2 points) is set.

~TPolyLine3D()
 3-D polyline destructor.

TPolyLine3D(const TPolyLine3D &polyline) : TObject(polyline), TAttLine(polyline), TAtt3D(polyline)
 3-D polyline copy ctor.

void Copy(TObject &obj) const
 Copy polyline to polyline obj.

Int_t DistancetoPrimitive(Int_t px, Int_t py)
 Compute distance from point px,py to a 3-D polyline.
 Compute the closest distance of approach from point px,py to each segment
 of the polyline.
 Returns when the distance found is below DistanceMaximum.
 The distance is computed in pixels units.

void Draw(Option_t *option)
 Draw this 3-D polyline with its current attributes.

void DrawOutlineCube(TList *outline, Double_t *rmin, Double_t *rmax)
 Draw cube outline with 3d polylines.

      xmin = fRmin[0]        xmax = fRmax[0]
      ymin = fRmin[1]        ymax = fRmax[1]
      zmin = fRmin[2]        zmax = fRmax[2]


    (xmin,ymax,zmax) +---------+ (xmax,ymax,zmax)
                    /         /|
                   /         / |
                  /         /  |
(xmin,ymin,zmax) +---------+   |
                 |         |   + (xmax,ymax,zmin)
                 |         |  
                 |         | 
                 |         |
                 +---------+
  (xmin,ymin,zmin)         (xmax,ymin,zmin)


void DrawPolyLine(Int_t n, Float_t *p, Option_t *option)
 Draw 3-D polyline with new coordinates. Creates a new polyline which
 will be adopted by the pad in which it is drawn. Does not change the
 original polyline (should be static method).

void ExecuteEvent(Int_t event, Int_t px, Int_t py)
 Execute action corresponding to one event.

void ls(Option_t *option) const
 List this 3-D polyline.

Int_t Merge(TCollection *li)
 Merge polylines in the collection in this polyline

void Paint(Option_t * /* option */ )
 Paint a TPolyLine3D.

void Print(Option_t *option) const
 Dump this 3-D polyline with its attributes on stdout.

void SavePrimitive(ofstream &out, Option_t *)
 Save primitive as a C++ statement(s) on output stream.

Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
 Set point following LastPoint to x, y, z.
 Returns index of the point (new last point).

void SetPoint(Int_t n, Double_t x, Double_t y, Double_t z)
 Set point n to x, y, z.
 If n is more then the current TPolyLine3D size (n > fN) then
 the polyline will be resized to contain at least n points.

void SetPolyLine(Int_t n, Option_t *option)
 Re-initialize polyline with n points (0,0,0).
 if n <= 0 the current array of points is deleted.

void SetPolyLine(Int_t n, Float_t *p, Option_t *option)
 Re-initialize polyline with n points from p. If p=0 initialize with 0.
 if n <= 0 the current array of points is deleted.

void SetPolyLine(Int_t n, Double_t *p, Option_t *option)
 Re-initialize polyline with n points from p. If p=0 initialize with 0.
 if n <= 0 the current array of points is deleted.

void Streamer(TBuffer &b)
 Stream a 3-D polyline object.



Inline Functions


               Int_t GetLastPoint() const
               Int_t GetN() const
            Float_t* GetP() const
           Option_t* GetOption() const
                void SetOption(Option_t* option = "")
               Int_t Size() const
             TClass* Class()
             TClass* IsA() const
                void ShowMembers(TMemberInspector& insp, char* parent)
                void StreamerNVirtual(TBuffer& b)
        TPolyLine3D& operator=(const TPolyLine3D&)


Author: Nenad Buncic 17/08/95
Last update: root/g3d:$Name: $:$Id: TPolyLine3D.cxx,v 1.24 2005/08/30 09:11:39 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.