Limbo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > > Class Template Reference

a class implement conversion from manhattan polygon to rectangle More...

#include <Polygon2RectangleVec.h>

Classes

struct  is_equal_type
 is equal helper More...
 

Public Types

typedef std::vector
< RectangleType > 
rectangle_set_type
 internal rectangle set type
 
typedef std::vector< PointType > point_set_type
 internal point set type
 
typedef container_traits
< point_set_type >::value_type 
point_type
 internal point type
 
typedef point_traits
< point_type >
::coordinate_type 
coordinate_type
 point set type for polygon
 
typedef container_traits
< rectangle_set_type >
::value_type 
rectangle_type
 internal rectangle type
 
typedef coordinate_traits
< coordinate_type >
::coordinate_distance 
coordinate_distance
 coordinate distance type
 
typedef coordinate_traits
< coordinate_type >
::manhattan_area_type 
manhattan_area_type
 manhattan area type
 

Public Member Functions

 Polygon2Rectangle (rectangle_set_type &vRect, slicing_orientation_2d slicing_orient=HORIZONTAL_SLICING)
 constructor More...
 
template<typename InputIterator >
 Polygon2Rectangle (rectangle_set_type &vRect, InputIterator input_begin, InputIterator input_end, slicing_orientation_2d slicing_orient)
 constructor More...
 
template<typename InputIterator >
void initialize (InputIterator input_begin, InputIterator input_end)
 initialize polygon points More...
 
bool operator() ()
 top api for limbo::geometry::Polygon2Rectangle More...
 
rectangle_set_type const & get_rectangles () const
 get rectangles More...
 
bool read (string const &filename)
 read polygon from file try to be compatible to gnuplot format More...
 
void print (string const &filename) const
 print polygon to file in gnuplot format More...
 

Protected Member Functions

coordinate_type get (point_type const &p, orientation_2d o) const
 get coordinate from point More...
 
coordinate_type get (rectangle_type const &r, direction_2d d) const
 get coordinate from rectangle More...
 
void set (point_type &p, orientation_2d o, coordinate_type v) const
 set coordinate of point More...
 
void set (rectangle_type &r, direction_2d d, coordinate_type v) const
 set coordinate of rectangle More...
 
void initialize (slicing_orientation_2d slicing_orient)
 initialize with slicing orientation it must be called before initializing other data More...
 
bool find_Pk_Pl_Pm (point_type &Pk, point_type &Pl, point_type &Pm, orientation_2d const &orient)
 find Pk, Pl, Pm, please refer to the paper for definition Given points, find Pk, Pl and Pm More...
 
void F (point_type const &point, orientation_2d const &orient)
 F function in the original paper remove point if found, otherwise insert. More...
 

Protected Attributes

std::vector< std::pair
< orientation_2d,
point_set_type > > 
m_mPoint
 
std::vector< unsigned char > m_vOrient2Id
 orientation_2d to index of m_mPoint
 
rectangle_set_typem_vRect
 save all rectangles from conversion
 
slicing_orientation_2d m_slicing_orient
 slicing orient
 

Detailed Description

template<typename PointType, typename RectangleType>
class limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >

a class implement conversion from manhattan polygon to rectangle

Parameters
PointSetis the container for internal storing vertices of polygon according to some experiments, std::vector is much faster than list, and set
RectSetis the container storing output rectangles

Definition at line 34 of file Polygon2RectangleVec.h.

Constructor & Destructor Documentation

template<typename PointType , typename RectangleType >
limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::Polygon2Rectangle ( rectangle_set_type vRect,
slicing_orientation_2d  slicing_orient = HORIZONTAL_SLICING 
)
inline

constructor

if slicing_orient == HORIZONTAL_SLICING or slicing_orient == VERTICAL_SLICING, only 1 copy of points is stored if slicing_orient == HOR_VER_SLICING, 2 copies of points sorted by different orientation are stored btw, slicing orientation is perpendicular to its corresponding sorting orientation

Parameters
vRectreference to the container for output rectangles
slicing_orientindicates the orientation of slicing

Definition at line 64 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
template<typename InputIterator >
limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::Polygon2Rectangle ( rectangle_set_type vRect,
InputIterator  input_begin,
InputIterator  input_end,
slicing_orientation_2d  slicing_orient 
)
inline

constructor

Template Parameters
InputIteratorrepresents the iterator type of point set container for construction only
Parameters
vRectreference to container for rectangles
input_beginbegin iterator of points
input_endend iterator of points
slicing_orientslicing orientation

Definition at line 81 of file Polygon2RectangleVec.h.

Member Function Documentation

template<typename PointType , typename RectangleType >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::F ( point_type const &  point,
orientation_2d const &  orient 
)
inlineprotected

F function in the original paper remove point if found, otherwise insert.

Parameters
pointa point to insert or remove
orientorientation

Definition at line 553 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
bool limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::find_Pk_Pl_Pm ( point_type Pk,
point_type Pl,
point_type Pm,
orientation_2d const &  orient 
)
inlineprotected

find Pk, Pl, Pm, please refer to the paper for definition Given points, find Pk, Pl and Pm

Parameters
Pkthe leftmost of the lowest points
Plthe next leftmost of the lowest points
Pm1) Xk <= Xm < Xl 2) Ym is lowest but Ym > Yk (Yk == Yl)
orientorientation

Definition at line 512 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
coordinate_type limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::get ( point_type const &  p,
orientation_2d  o 
) const
inlineprotected

get coordinate from point

Parameters
ppoint
oorientation
Returns
coordinate

Definition at line 432 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
coordinate_type limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::get ( rectangle_type const &  r,
direction_2d  d 
) const
inlineprotected

get coordinate from rectangle

Parameters
rrectangle
ddirection
Returns
coordinate

Definition at line 439 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
rectangle_set_type const& limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::get_rectangles ( ) const
inline

get rectangles

Returns
result rectangles

Definition at line 314 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
template<typename InputIterator >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::initialize ( InputIterator  input_begin,
InputIterator  input_end 
)
inline

initialize polygon points

Template Parameters
InputIteratorrepresents the iterator type of point set container for construction only
Parameters
input_beginbegin iterator of points
input_endend iterator of points

Definition at line 97 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::initialize ( slicing_orientation_2d  slicing_orient)
inlineprotected

initialize with slicing orientation it must be called before initializing other data

Parameters
slicing_orientslicing orientation

Definition at line 477 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
bool limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::operator() ( )
inline

top api for limbo::geometry::Polygon2Rectangle

Returns
true if succeed

Definition at line 204 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::print ( string const &  filename) const
inline

print polygon to file in gnuplot format

Parameters
filenameoutput file name

Definition at line 384 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
bool limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::read ( string const &  filename)
inline

read polygon from file try to be compatible to gnuplot format

Returns
true if succeed

Definition at line 323 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::set ( point_type p,
orientation_2d  o,
coordinate_type  v 
) const
inlineprotected

set coordinate of point

Parameters
ppoint
oorientation
vcoordinate value

Definition at line 446 of file Polygon2RectangleVec.h.

template<typename PointType , typename RectangleType >
void limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::set ( rectangle_type r,
direction_2d  d,
coordinate_type  v 
) const
inlineprotected

set coordinate of rectangle

Parameters
rrectangle
ddirection
vcoordinate value

Definition at line 453 of file Polygon2RectangleVec.h.

Member Data Documentation

template<typename PointType , typename RectangleType >
std::vector<std::pair<orientation_2d, point_set_type> > limbo::geometry::Polygon2Rectangle< std::vector< PointType >, std::vector< RectangleType > >::m_mPoint
protected

save all points of a polygon 1~2 copies, sort by left lower or by lower left for HORIZONTAL key, sort by left lower for VERTICAL key, sort by lower left

Definition at line 569 of file Polygon2RectangleVec.h.


The documentation for this class was generated from the following file: