TPolyLine3D


class description - source file - inheritance tree

class TPolyLine3D : public TObject, public TAttLine, public TAtt3D


    public:
TPolyLine3D TPolyLine3D() TPolyLine3D TPolyLine3D(Int_t n, Option_t* option) TPolyLine3D TPolyLine3D(Int_t n, Float_t* p, Option_t* option) TPolyLine3D TPolyLine3D(Int_t n, Double_t* p, Option_t* option) TPolyLine3D TPolyLine3D(Int_t n, Float_t* x, Float_t* y, Float_t* z, Option_t* option) TPolyLine3D TPolyLine3D(Int_t n, Double_t* x, Double_t* y, Double_t* z, Option_t* option) TPolyLine3D TPolyLine3D(const TPolyLine3D& polylin) virtual void ~TPolyLine3D() static TClass* Class() virtual void Copy(TObject& polyline) 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) virtual void Paint(Option_t* option) virtual void PaintPolyLine(Int_t n, Float_t* p, Option_t* option) virtual void PaintPolyLine(Int_t n, Double_t* p, 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 Sizeof3D() 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


See also

THelix

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)
 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.

      x = fRmin[0]        X = fRmax[0]
      y = fRmin[1]        Y = fRmax[1]
      z = fRmin[2]        Z = fRmax[2]


            (x,Y,Z) +---------+ (X,Y,Z)
                   /         /|
                  /         / |
                 /         /  |
        (x,y,Z) +---------+   |
                |         |   + (X,Y,z)
                |         |  
                |         | 
                |         |
                +---------+
             (x,y,z)   (X,y,z)


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 *list)
 Merge polylines in the collection in this polyline

void Paint(Option_t *option)
 Paint this 3-D polyline with its current attributes.
 Option could be 'x3d', and it means that output
 will be performed by X3D package.

void PaintPolyLine(Int_t n, Float_t *p, Option_t *)
 Draw this 3-D polyline with new coordinates from p. Does not change
 original polyline. Should be static method.

void PaintPolyLine(Int_t n, Double_t *p, Option_t *)
 Draw this 3-D polyline with new coordinates from p. Does not change
 original polyline. Should be static method.

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).

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.

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.

void Sizeof3D() const
 Return total X3D size of this 3-D polyline with its attributes.

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)


Author: Nenad Buncic 17/08/95
Last update: root/g3d:$Name: $:$Id: TPolyLine3D.cxx,v 1.12 2002/05/18 08:21:59 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - 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.