BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
A polygon, for use in detector masks. More...
Public Member Functions | |
Polygon (const PolygonPrivate *d) | |
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... | |
virtual | ~Polygon () |
virtual Polygon * | clone () const |
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). More... | |
virtual bool | contains (double x, double y) const |
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 | |
virtual void | print (std::ostream &ostr) const |
Private Attributes | |
PolygonPrivate * | m_d |
const char *const | m_name |
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.
Polygon::Polygon | ( | const std::vector< double > | x, |
const std::vector< double > | y | ||
) |
x | Vector of x-coordinates of polygon points. |
y | Vector of y-coordinates of polygon points. |
Definition at line 63 of file Polygon.cpp.
References PolygonPrivate::init_from(), and m_d.
Referenced by clone().
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.
points | Two dimensional vector of (x,y) coordinates of polygon points. |
Definition at line 75 of file Polygon.cpp.
References PolygonPrivate::init_from(), and m_d.
Polygon::Polygon | ( | const PolygonPrivate * | d | ) |
Definition at line 91 of file Polygon.cpp.
|
virtual |
|
inlinevirtual |
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 104 of file Polygon.cpp.
References Bin1D::center(), and contains().
|
virtual |
Returns true if point with given coordinates is inside or on border of the shape.
Implements IShape2D.
Definition at line 98 of file Polygon.cpp.
References m_d, and PolygonPrivate::polygon.
Referenced by contains().
double Polygon::getArea | ( | ) | const |
Definition at line 109 of file Polygon.cpp.
References m_d, and PolygonPrivate::polygon.
void Polygon::getPoints | ( | std::vector< double > & | xpos, |
std::vector< double > & | ypos | ||
) | const |
Definition at line 114 of file Polygon.cpp.
References PolygonPrivate::get_points(), and m_d.
|
protectedvirtual |
Reimplemented from IShape2D.
Definition at line 119 of file Polygon.cpp.
References m_d, and PolygonPrivate::polygon.
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 34 of file ICloneable.h.
|
private |
Definition at line 51 of file Polygon.h.
Referenced by Polygon(), ~Polygon(), clone(), contains(), getArea(), getPoints(), and print().
|
privateinherited |
Definition at line 49 of file IShape2D.h.
Referenced by IShape2D::print().