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

Description

A rectangle, for use in detector masks.

Edges are along the coordinate axes.

Inheritance diagram for Rectangle:

Public Member Functions

 Rectangle (double xlow, double ylow, double xup, double yup, bool inverted=false)
 
Rectangleclone () 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
 
double getXlow () const
 
double getXup () const
 
double getYlow () const
 
double getYup () const
 
void setInverted (bool inverted=true)
 

Protected Member Functions

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

Constructor & Destructor Documentation

◆ Rectangle()

Rectangle::Rectangle ( double  xlow,
double  ylow,
double  xup,
double  yup,
bool  inverted = false 
)

Member Function Documentation

◆ clone()

Rectangle* Rectangle::clone ( ) const
overridevirtual

Implements IShape2D.

◆ contains() [1/2]

bool Rectangle::contains ( const Bin1D binx,
const Bin1D biny 
) const
overridevirtual

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.

◆ contains() [2/2]

bool Rectangle::contains ( double  x,
double  y 
) const
overridevirtual

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

Implements IShape2D.

◆ getArea()

double Rectangle::getArea ( ) const

◆ getXlow()

double Rectangle::getXlow ( ) const

◆ getXup()

double Rectangle::getXup ( ) const

◆ getYlow()

double Rectangle::getYlow ( ) const

◆ getYup()

double Rectangle::getYup ( ) const

◆ print()

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

Reimplemented in Polygon.

◆ setInverted()

void Rectangle::setInverted ( bool  inverted = true)