TwiceAsNice  2019-02-18
Public Member Functions | Public Attributes | List of all members
Nice::NicePolygon Class Reference

This class represents a polygon, a sequence of connected lines. More...

#include <NicePolygon.h>

Collaboration diagram for Nice::NicePolygon:
Collaboration graph

Public Member Functions

 NicePolygon ()
 Default ctor. More...
 
 NicePolygon (const SeqLine &linetrain)
 construct the polyogn from a sequence of consecutive lines. More...
 
void append (const Nice::Point &pt)
 extend the polygon by adding a point at the end. More...
 
void close ()
 Close the polygon by adding a line from the last to the first point. More...
 
Nice::Line lineSeg (int idx) const
 retrieve the idx-th line segment. More...
 
Nice::Line::IntersectType intersect (const Nice::NicePolygon &oth) const
 Check whether any of the line segments intersects with another polygon. More...
 
 NicePolygon ()
 
 NicePolygon (const SeqLine &linetrain)
 
void append (const Nice::Point &pt)
 
void close ()
 
Nice::Line lineSeg (int idx) const
 
Nice::Line::IntersectType intersect (const Nice::NicePolygon &oth) const
 

Public Attributes

std::vector< Nice::Pointpts
 The sequence of points that define the polygon. More...
 

Detailed Description

This class represents a polygon, a sequence of connected lines.

Constructor & Destructor Documentation

◆ NicePolygon() [1/4]

Nice::NicePolygon::NicePolygon ( )

Default ctor.


This defines a polygon without points.

Since
2017-03-31

◆ NicePolygon() [2/4]

Nice::NicePolygon::NicePolygon ( const SeqLine linetrain)

construct the polyogn from a sequence of consecutive lines.


Parameters
linetrainThe line segments that define the polygon. The ctor assumes that the end point of each segment is equal to the start point of the next segment, without checking this assumption.
Since
2017-03-31

◆ NicePolygon() [3/4]

Nice::NicePolygon::NicePolygon ( )

◆ NicePolygon() [4/4]

Nice::NicePolygon::NicePolygon ( const SeqLine linetrain)

Member Function Documentation

◆ append() [1/2]

void Nice::NicePolygon::append ( const Nice::Point pt)

extend the polygon by adding a point at the end.


Parameters
ptThe additional point to be appended.
Since
2017-03-31

◆ append() [2/2]

void Nice::NicePolygon::append ( const Nice::Point pt)

◆ close() [1/2]

void Nice::NicePolygon::close ( void  )

Close the polygon by adding a line from the last to the first point.


Since
2017-03-31

◆ close() [2/2]

void Nice::NicePolygon::close ( )

◆ intersect() [1/2]

Nice::Line::IntersectType Nice::NicePolygon::intersect ( const Nice::NicePolygon oth) const

◆ intersect() [2/2]

Nice::Line::IntersectType Nice::NicePolygon::intersect ( const Nice::NicePolygon oth) const

Check whether any of the line segments intersects with another polygon.


All line segments of this are checked for intersection with the line segments of the other polygon.

Parameters
othThe other polygon.
Returns
NoIntersection if no lines intersect, BoundedIntersection if some touch. Note that NoIntersection is also returned if one polygon is entirely within another.
Since
2017-03-30

◆ lineSeg() [1/2]

Nice::Line Nice::NicePolygon::lineSeg ( int  idx) const

retrieve the idx-th line segment.


Parameters
idxThe 0-based line segment
Returns
The line starting at point idx. If the idx is outside the range of known points, a null line (as defined by Nice, whatever that might be) is returned
Since
2017-03-30

◆ lineSeg() [2/2]

Nice::Line Nice::NicePolygon::lineSeg ( int  idx) const

Member Data Documentation

◆ pts

std::vector< Nice::Point > Nice::NicePolygon::pts

The sequence of points that define the polygon.


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