BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Polygon Class Reference

A polygon in 2D space. More...

+ Inheritance diagram for Polygon:

Public Member Functions

 Polygon (const std::vector< double > x, const std::vector< double > y)
 
 Polygon (const std::vector< std::vector< double >> points)
 Polygon defined by two dimensional array with (x,y) coordinates of polygon points. More...
 
 Polygon (const PolygonPrivate *d)
 
virtual Polygonclone () const
 
virtual bool contains (double x, double y) const
 Returns true if point with given coordinates is inside or on border of the shape.
 
virtual bool contains (const Bin1D &binx, const Bin1D &biny) const
 Returns true if area defined by two bins is inside or on border of polygon (more precisely, if mid point of two bins satisfy this condition).
 
double getArea () const
 
void getPoints (std::vector< double > &xpos, std::vector< double > &ypos) const
 
- Public Member Functions inherited from IShape2D
 IShape2D (const char *name)
 
- Public Member Functions inherited from ICloneable
 ICloneable (const ICloneable &)=delete
 
 ICloneable (ICloneable &&)=default
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py)
 

Protected Member Functions

virtual void print (std::ostream &ostr) const
 

Detailed Description

A polygon in 2D space.

Polygon defined by two arrays with x and y coordinates of points. Sizes of arrays should coincide. If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically.

Definition at line 30 of file Polygon.h.

Constructor & Destructor Documentation

◆ Polygon() [1/2]

Polygon::Polygon ( const std::vector< double >  x,
const std::vector< double >  y 
)
Parameters
xVector of x-coordinates of polygon points.
yVector of y-coordinates of polygon points.

Definition at line 65 of file Polygon.cpp.

◆ Polygon() [2/2]

Polygon::Polygon ( const std::vector< std::vector< double >>  points)

Polygon defined by two dimensional array with (x,y) coordinates of polygon points.

The size of second dimension should be 2. If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically.

Parameters
pointsTwo dimensional vector of (x,y) coordinates of polygon points.

Definition at line 77 of file Polygon.cpp.


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