title
Graph Drawing Toolkit

An object-oriented C++ library for handling and drawing graphs

rm3_interval_set.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 +
00003 +  rm3_interval_set.h
00004 +
00005 +  This file is part of GDToolkit. It can be 
00006 +  used free of charge in academic research and teaching. 
00007 +  Any direct or indirect commercial use of this software is illegal 
00008 +  without a written authorization of
00009 +  the Dipartimento di Informatica e Automazione
00010 +  Universita' di Roma Tre, Roma, ITALIA
00011 +
00012 +
00013 *******************************************************************************/
00016 #ifndef RM3_INTERVAL_SET_H
00017 #define RM3_INTERVAL_SET_H
00018 
00019 #if !defined(ROOT_INCL_ID)
00020 #define ROOT_INCL_ID 34015
00021 #endif
00022 
00023 #include <GDT/gdtlist.h>
00024 
00025 
00033 class GDT_interval_set
00034    {
00035    private:
00036      GDT_interval_set(const GDT_interval_set& );
00037      GDT_interval_set& operator=(const GDT_interval_set& );
00038    private:
00039      struct _interval
00040        {
00041            // end points
00042          const double from;
00043          const double to;
00044            // second coordinate
00045          const double z;
00046 
00047          _interval(double f, double t, double zz):
00048            from(f),
00049            to(t),
00050            z(zz)
00051            {}
00052        };
00053    public:
00054      typedef _interval* interval;
00055 
00056    private:
00057 
00058      gdt::gdtlist< interval > the_set;
00059 
00060 
00061      /* 
00062         It return NULL if no interval has been hitted.
00063         The ray is shot at x position starting at z altitude. It shoot up if "up==true", 
00064         down if "up==false".
00065      */
00066 
00067      interval ray_shooting_generic( double x, double z, bool up);
00068 
00069    public:
00070      GDT_interval_set() {};
00071 
00072      ~GDT_interval_set();
00073 
00074 
00075    public:
00076 
00077      /* accessors */
00078      double altitude(interval i) const
00079        { return i->z; }
00080 
00081      double left(interval i) const
00082        { return i->from; }
00083 
00084      double right(interval i) const
00085        { return i->to; }
00086 
00087      /* modifiers */
00088 
00089      interval new_interval( double f, double t, double z );
00090 
00091      void del_interval( interval i ); 
00092 
00093      interval ray_shooting_up( double x, double z)
00094        { return ray_shooting_generic( x, z, true ); }
00095 
00096      interval ray_shooting_down( double x, double z)
00097        { return ray_shooting_generic( x, z, false ); }
00098 
00099      void print(std::ostream& o) const;
00100    };
00101 
00102 
00103 std::ostream& operator<< (std::ostream& o, GDT_interval_set::interval i);
00104 std::ostream& operator<< (std::ostream& o, const GDT_interval_set& s);
00105 
00106 #endif
00107 

Generated on Thu Jan 10 14:48:01 2008 for GDToolkit GAPI by  doxygen 1.5.3