BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
A polygon, for use in detector masks.
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.
Public Member Functions | |
Polygon (const PolygonPrivate *d) | |
Polygon (std::vector< double > x, std::vector< double > y) | |
If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically. More... | |
Polygon (std::vector< std::pair< double, double >> points) | |
If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically. More... | |
~Polygon () override | |
Polygon * | clone () const override |
bool | contains (const Bin1D &binx, const Bin1D &biny) const override |
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). More... | |
bool | contains (double x, double y) const override |
Returns true if point with given coordinates is inside or on border of the shape. More... | |
double | getArea () const |
void | getPoints (std::vector< double > &xpos, std::vector< double > &ypos) const |
virtual void | transferToCPP () |
Used for Python overriding of clone (see swig/tweaks.py) More... | |
Protected Member Functions | |
void | print (std::ostream &ostr) const override |
Private Attributes | |
PolygonPrivate * | m_d |
const char *const | m_name |
Polygon::Polygon | ( | std::vector< double > | x, |
std::vector< double > | y | ||
) |
If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically.
x | Vector of x-coordinates of polygon points. |
y | Vector of y-coordinates of polygon points. |
Definition at line 71 of file Polygon.cpp.
Referenced by clone().
Polygon::Polygon | ( | std::vector< std::pair< double, double >> | points | ) |
If polygon is unclosed (the last point doesn't repeat the first one), it will be closed automatically.
points | Two dimensional vector of (x,y) coordinates of polygon points. |
Definition at line 82 of file Polygon.cpp.
Polygon::Polygon | ( | const PolygonPrivate * | d | ) |
Definition at line 88 of file Polygon.cpp.
|
override |
|
inlineoverridevirtual |
Implements IShape2D.
Definition at line 38 of file Polygon.h.
References Polygon(), and m_d.
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).
Implements IShape2D.
Definition at line 105 of file Polygon.cpp.
References Bin1D::center(), and contains().
|
overridevirtual |
Returns true if point with given coordinates is inside or on border of the shape.
Implements IShape2D.
Definition at line 99 of file Polygon.cpp.
References m_d.
Referenced by contains().
double Polygon::getArea | ( | ) | const |
Definition at line 110 of file Polygon.cpp.
References m_d.
void Polygon::getPoints | ( | std::vector< double > & | xpos, |
std::vector< double > & | ypos | ||
) | const |
Definition at line 115 of file Polygon.cpp.
References m_d.
|
overrideprotectedvirtual |
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 32 of file ICloneable.h.
|
private |
Definition at line 51 of file Polygon.h.
Referenced by ~Polygon(), clone(), contains(), getArea(), getPoints(), and print().
|
privateinherited |
Definition at line 52 of file IShape2D.h.
Referenced by IShape2D::print().