BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IShape2D Class Referenceabstract
Inheritance diagram for IShape2D:
Collaboration diagram for IShape2D:

Public Member Functions

 IShape2D (const char *name)
 
virtual IShape2Dclone () const =0
 
virtual bool contains (double x, double y) const =0
 
virtual bool contains (const Bin1D &binx, const Bin1D &biny) const =0
 
virtual void transferToCPP ()
 

Protected Member Functions

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

Private Attributes

const char *const m_name
 

Friends

std::ostream & operator<< (std::ostream &ostr, const IShape2D &shape)
 

Detailed Description

Basic class for all shapes in 2D.

Definition at line 26 of file IShape2D.h.

Constructor & Destructor Documentation

◆ IShape2D()

IShape2D::IShape2D ( const char *  name)
inline

Definition at line 29 of file IShape2D.h.

29 : m_name(name) {}
const char *const m_name
Definition: IShape2D.h:49

Member Function Documentation

◆ clone()

virtual IShape2D* IShape2D::clone ( ) const
pure virtual

◆ contains() [1/2]

virtual bool IShape2D::contains ( double  x,
double  y 
) const
pure virtual

Returns true if point with given coordinates is inside or on border of the shape.

Implemented in InfinitePlane, Rectangle, Polygon, HorizontalLine, VerticalLine, Line, and Ellipse.

Referenced by DetectorMask::process_masks().

◆ contains() [2/2]

virtual bool IShape2D::contains ( const Bin1D binx,
const Bin1D biny 
) const
pure virtual

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

Implemented in Rectangle, Polygon, HorizontalLine, VerticalLine, Line, Ellipse, and InfinitePlane.

◆ print()

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

Reimplemented in Polygon.

Definition at line 46 of file IShape2D.h.

46 { ostr << m_name; }

References m_name.

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

Used for Python overriding of clone (see swig/tweaks.py)

Definition at line 34 of file ICloneable.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const IShape2D shape 
)
friend

Definition at line 39 of file IShape2D.h.

40  {
41  shape.print(ostr);
42  return ostr;
43  }
virtual void print(std::ostream &ostr) const
Definition: IShape2D.h:46

Member Data Documentation

◆ m_name

const char* const IShape2D::m_name
private

Definition at line 49 of file IShape2D.h.

Referenced by print().


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