KiCad PCB EDA Suite
SutherlandHodgman Class Reference

#include <SutherlandHodgmanClipPoly.h>


class  BoundaryHor
class  BoundaryVert
class  ClipStage
class  OutputStage

Public Member Functions

 SutherlandHodgman (RectF &boundaries)
void Clip (pointVector &input, pointVector &clipped)

Private Types

typedef BoundaryVert< std::less< REAL > > BoundaryRight
typedef BoundaryHor< std::greater_equal< REAL > > BoundaryTop
typedef BoundaryVert< std::greater_equal< REAL > > BoundaryLeft
typedef BoundaryHor< std::less< REAL > > BoundaryBottom
typedef ClipStage< BoundaryBottom, OutputStageClipBottom
typedef ClipStage< BoundaryLeft, ClipBottomClipLeft
typedef ClipStage< BoundaryTop, ClipLeftClipTop
typedef ClipStage< BoundaryRight, ClipTopClipRight

Private Attributes

OutputStage m_stageOut
ClipBottom m_stageBottom
ClipLeft m_stageLeft
ClipTop m_stageTop
ClipRight m_stageRight

Detailed Description

Definition at line 86 of file SutherlandHodgmanClipPoly.h.

Member Typedef Documentation

typedef BoundaryHor<std::less<REAL> > SutherlandHodgman::BoundaryBottom

Definition at line 256 of file SutherlandHodgmanClipPoly.h.

typedef BoundaryVert<std::greater_equal<REAL> > SutherlandHodgman::BoundaryLeft

Definition at line 255 of file SutherlandHodgmanClipPoly.h.

typedef BoundaryVert<std::less<REAL> > SutherlandHodgman::BoundaryRight

Definition at line 253 of file SutherlandHodgmanClipPoly.h.

typedef BoundaryHor<std::greater_equal<REAL> > SutherlandHodgman::BoundaryTop

Definition at line 254 of file SutherlandHodgmanClipPoly.h.

Constructor & Destructor Documentation

SutherlandHodgman::SutherlandHodgman ( RectF boundaries)

Definition at line 96 of file SutherlandHodgmanClipPoly.h.

96  :
97  m_stageBottom( m_stageOut, boundaries.GetBottom() )
98  , /* Initialize each stage */ m_stageLeft( m_stageBottom, boundaries.GetLeft() )
99  , /* with its next stage and */ m_stageTop( m_stageLeft, boundaries.GetTop() )
100  , /* the boundary position. */ m_stageRight( m_stageTop, boundaries.GetRight() )
101  {
102  }
REAL GetBottom() const
REAL GetTop() const
REAL GetRight() const
REAL GetLeft() const

Member Function Documentation

void SutherlandHodgman::Clip ( pointVector input,
pointVector clipped 

Definition at line 105 of file SutherlandHodgmanClipPoly.h.

106  {
107  clipped.clear();
108  m_stageOut.SetDestination( &clipped );
110  // Clip each input vertex.
111  for( cpointIterator it = input.begin(); it != input.end(); ++it )
112  m_stageRight.HandleVertex( *it );
114  // Do the final step.
116  }
std::vector< PointF >::const_iterator cpointIterator
void HandleVertex(const PointF &pntCurrent)

Member Data Documentation

ClipBottom SutherlandHodgman::m_stageBottom

Definition at line 267 of file SutherlandHodgmanClipPoly.h.

ClipLeft SutherlandHodgman::m_stageLeft

Definition at line 268 of file SutherlandHodgmanClipPoly.h.

OutputStage SutherlandHodgman::m_stageOut

Definition at line 266 of file SutherlandHodgmanClipPoly.h.

ClipRight SutherlandHodgman::m_stageRight

Definition at line 270 of file SutherlandHodgmanClipPoly.h.

ClipTop SutherlandHodgman::m_stageTop

Definition at line 269 of file SutherlandHodgmanClipPoly.h.

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