KiCad PCB EDA Suite
SutherlandHodgman Class Reference

#include <SutherlandHodgmanClipPoly.h>

Classes

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
private

Definition at line 256 of file SutherlandHodgmanClipPoly.h.

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

Definition at line 255 of file SutherlandHodgmanClipPoly.h.

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

Definition at line 253 of file SutherlandHodgmanClipPoly.h.

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

Definition at line 254 of file SutherlandHodgmanClipPoly.h.

Constructor & Destructor Documentation

SutherlandHodgman::SutherlandHodgman ( RectF boundaries)
inline

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

Definition at line 105 of file SutherlandHodgmanClipPoly.h.

References SutherlandHodgman::ClipStage< Boundary, Stage >::Finalize(), SutherlandHodgman::ClipStage< Boundary, Stage >::HandleVertex(), m_stageOut, m_stageRight, and SutherlandHodgman::OutputStage::SetDestination().

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

Member Data Documentation

ClipBottom SutherlandHodgman::m_stageBottom
private

Definition at line 267 of file SutherlandHodgmanClipPoly.h.

ClipLeft SutherlandHodgman::m_stageLeft
private

Definition at line 268 of file SutherlandHodgmanClipPoly.h.

OutputStage SutherlandHodgman::m_stageOut
private

Definition at line 266 of file SutherlandHodgmanClipPoly.h.

Referenced by Clip().

ClipRight SutherlandHodgman::m_stageRight
private

Definition at line 270 of file SutherlandHodgmanClipPoly.h.

Referenced by Clip().

ClipTop SutherlandHodgman::m_stageTop
private

Definition at line 269 of file SutherlandHodgmanClipPoly.h.


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