Limbo 3.5.4
Loading...
Searching...
No Matches
limbo::geometry::Polygon2Rectangle< PointSet, RectSet > Class Template Reference

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

#include <Polygon2Rectangle.h>

Classes

struct  is_equal_type
 is equal helper More...

Public Types

typedef RectSet rectangle_set_type
 internal rectangle set type
typedef PointSet 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
template<typename InputIterator>
 Polygon2Rectangle (rectangle_set_type &vRect, InputIterator input_begin, InputIterator input_end, slicing_orientation_2d slicing_orient)
 constructor
template<typename InputIterator>
void initialize (InputIterator input_begin, InputIterator input_end)
 initialize polygon points
bool operator() ()
 top api for limbo::geometry::Polygon2Rectangle
rectangle_set_type const & get_rectangles () const
 get rectangles
bool read (string const &filename)
 read polygon from file try to be compatible to gnuplot format
void print (string const &filename) const
 print polygon to file in gnuplot format

Protected Member Functions

coordinate_type get (point_type const &p, orientation_2d o) const
 get coordinate from point
coordinate_type get (rectangle_type const &r, direction_2d d) const
 get coordinate from rectangle
void set (point_type &p, orientation_2d o, coordinate_type v) const
 set coordinate of point
void set (rectangle_type &r, direction_2d d, coordinate_type v) const
 set coordinate of rectangle
void initialize (slicing_orientation_2d slicing_orient)
 initialize with slicing orientation it must be called before initializing other data
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
void F (point_type const &point, orientation_2d const &orient)
 F function in the original paper remove point if found, otherwise insert.

Protected Attributes

map< orientation_2d, point_set_typem_mPoint
rectangle_set_typem_vRect
 save all rectangles from conversion
slicing_orientation_2d m_slicing_orient
 slicing orient

Detailed Description

template<typename PointSet, typename RectSet>
class limbo::geometry::Polygon2Rectangle< PointSet, RectSet >

a class implement conversion from manhattan polygon to rectangle

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

Definition at line 90 of file Polygon2Rectangle.h.

Member Typedef Documentation

◆ coordinate_distance

template<typename PointSet, typename RectSet>
typedef coordinate_traits<coordinate_type>::coordinate_distance limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::coordinate_distance

coordinate distance type

Definition at line 104 of file Polygon2Rectangle.h.

◆ coordinate_type

template<typename PointSet, typename RectSet>
typedef point_traits<point_type>::coordinate_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::coordinate_type

point set type for polygon

Definition at line 100 of file Polygon2Rectangle.h.

◆ manhattan_area_type

template<typename PointSet, typename RectSet>
typedef coordinate_traits<coordinate_type>::manhattan_area_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::manhattan_area_type

manhattan area type

Definition at line 106 of file Polygon2Rectangle.h.

◆ point_set_type

template<typename PointSet, typename RectSet>
typedef PointSet limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::point_set_type

internal point set type

Definition at line 96 of file Polygon2Rectangle.h.

◆ point_type

template<typename PointSet, typename RectSet>
typedef container_traits<point_set_type>::value_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::point_type

internal point type

Definition at line 98 of file Polygon2Rectangle.h.

◆ rectangle_set_type

template<typename PointSet, typename RectSet>
typedef RectSet limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::rectangle_set_type

internal rectangle set type

Definition at line 94 of file Polygon2Rectangle.h.

◆ rectangle_type

template<typename PointSet, typename RectSet>
typedef container_traits<rectangle_set_type>::value_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::rectangle_type

internal rectangle type

Definition at line 102 of file Polygon2Rectangle.h.

Constructor & Destructor Documentation

◆ Polygon2Rectangle() [1/2]

template<typename PointSet, typename RectSet>
limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 118 of file Polygon2Rectangle.h.

◆ Polygon2Rectangle() [2/2]

template<typename PointSet, typename RectSet>
template<typename InputIterator>
limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 134 of file Polygon2Rectangle.h.

Member Function Documentation

◆ F()

template<typename PointSet, typename RectSet>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 617 of file Polygon2Rectangle.h.

◆ find_Pk_Pl_Pm()

template<typename PointSet, typename RectSet>
bool limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 576 of file Polygon2Rectangle.h.

◆ get() [1/2]

template<typename PointSet, typename RectSet>
coordinate_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::get ( point_type const & p,
orientation_2d o ) const
inlineprotected

get coordinate from point

Parameters
ppoint
oorientation
Returns
coordinate

Definition at line 489 of file Polygon2Rectangle.h.

◆ get() [2/2]

template<typename PointSet, typename RectSet>
coordinate_type limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::get ( rectangle_type const & r,
direction_2d d ) const
inlineprotected

get coordinate from rectangle

Parameters
rrectangle
ddirection
Returns
coordinate

Definition at line 496 of file Polygon2Rectangle.h.

◆ get_rectangles()

template<typename PointSet, typename RectSet>
rectangle_set_type const & limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::get_rectangles ( ) const
inline

get rectangles

Returns
result rectangles

Definition at line 371 of file Polygon2Rectangle.h.

◆ initialize() [1/2]

template<typename PointSet, typename RectSet>
template<typename InputIterator>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 149 of file Polygon2Rectangle.h.

◆ initialize() [2/2]

template<typename PointSet, typename RectSet>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 534 of file Polygon2Rectangle.h.

◆ operator()()

template<typename PointSet, typename RectSet>
bool limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::operator() ( )
inline

top api for limbo::geometry::Polygon2Rectangle

Returns
true if succeed

Definition at line 256 of file Polygon2Rectangle.h.

◆ print()

template<typename PointSet, typename RectSet>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::print ( string const & filename) const
inline

print polygon to file in gnuplot format

Parameters
filenameoutput file name

Definition at line 441 of file Polygon2Rectangle.h.

◆ read()

template<typename PointSet, typename RectSet>
bool limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::read ( string const & filename)
inline

read polygon from file try to be compatible to gnuplot format

Returns
true if succeed

Definition at line 380 of file Polygon2Rectangle.h.

◆ set() [1/2]

template<typename PointSet, typename RectSet>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::set ( point_type & p,
orientation_2d o,
coordinate_type v ) const
inlineprotected

set coordinate of point

Parameters
ppoint
oorientation
vcoordinate value

Definition at line 503 of file Polygon2Rectangle.h.

◆ set() [2/2]

template<typename PointSet, typename RectSet>
void limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::set ( rectangle_type & r,
direction_2d d,
coordinate_type v ) const
inlineprotected

set coordinate of rectangle

Parameters
rrectangle
ddirection
vcoordinate value

Definition at line 510 of file Polygon2Rectangle.h.

Member Data Documentation

◆ m_mPoint

template<typename PointSet, typename RectSet>
map<orientation_2d, point_set_type> limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::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 669 of file Polygon2Rectangle.h.

◆ m_slicing_orient

template<typename PointSet, typename RectSet>
slicing_orientation_2d limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::m_slicing_orient
protected

slicing orient

Definition at line 674 of file Polygon2Rectangle.h.

◆ m_vRect

template<typename PointSet, typename RectSet>
rectangle_set_type& limbo::geometry::Polygon2Rectangle< PointSet, RectSet >::m_vRect
protected

save all rectangles from conversion

Definition at line 673 of file Polygon2Rectangle.h.


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