BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IShape2D Class Referenceabstract

Description

Basic class for all shapes in 2D.

Inheritance diagram for IShape2D:

Public Member Functions

 IShape2D (const char *name)
 
 ~IShape2D () override=default
 
IShape2Dclone () const override=0
 
virtual bool contains (const Bin1D &binx, const Bin1D &biny) const =0
 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 =0
 Returns true if point with given coordinates is inside or on border of the shape. More...
 

Protected Member Functions

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

Friends

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

Constructor & Destructor Documentation

◆ IShape2D()

IShape2D::IShape2D ( const char *  name)

◆ ~IShape2D()

IShape2D::~IShape2D ( )
overridedefault

Member Function Documentation

◆ clone()

IShape2D* IShape2D::clone ( ) const
overridepure virtual

◆ contains() [1/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, and Ellipse.

◆ contains() [2/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 Rectangle, Polygon, HorizontalLine, VerticalLine, Line, and Ellipse.

◆ print()

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

Reimplemented in Polygon.

Friends And Related Function Documentation

◆ operator<<

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