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

Public Member Functions

 VerticalLine (double x)
 
VerticalLineclone () const
 
bool contains (double x, double y) const
 
bool contains (const Bin1D &binx, const Bin1D &biny) const
 
double getXpos () const
 
virtual void transferToCPP ()
 

Protected Member Functions

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

Private Attributes

double m_x
 
const char *const m_name
 

Detailed Description

An infinite vertical line.

Definition at line 39 of file Line.h.

Constructor & Destructor Documentation

◆ VerticalLine()

VerticalLine::VerticalLine ( double  x)
Parameters
xThe value at which it crosses x-axes

Definition at line 68 of file Line.cpp.

68 : IShape2D("VerticalLine"), m_x(x) {}
IShape2D(const char *name)
Definition: IShape2D.h:29
double m_x
Definition: Line.h:51

Referenced by clone().

Member Function Documentation

◆ clone()

VerticalLine* VerticalLine::clone ( ) const
inlinevirtual

Implements IShape2D.

Definition at line 43 of file Line.h.

43 { return new VerticalLine(m_x); }
VerticalLine(double x)
Definition: Line.cpp:68

References m_x, and VerticalLine().

Here is the call graph for this function:

◆ contains() [1/2]

bool VerticalLine::contains ( double  x,
double  y 
) const
virtual

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

Implements IShape2D.

Definition at line 70 of file Line.cpp.

71 {
72  return algo::almostEqual(x, m_x);
73 }
bool almostEqual(double a, double b)
Returns true if two doubles agree within machine epsilon.
Definition: Algorithms.h:30

References algo::almostEqual(), and m_x.

Here is the call graph for this function:

◆ contains() [2/2]

bool VerticalLine::contains ( const Bin1D binx,
const Bin1D biny 
) const
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).

Implements IShape2D.

Definition at line 75 of file Line.cpp.

76 {
77  return m_x >= binx.m_lower && m_x <= binx.m_upper;
78 }
double m_upper
upper bound of the bin
Definition: Bin.h:24
double m_lower
lower bound of the bin
Definition: Bin.h:23

References Bin1D::m_lower, Bin1D::m_upper, and m_x.

◆ getXpos()

double VerticalLine::getXpos ( ) const
inline

Definition at line 48 of file Line.h.

48 { return m_x; }

References m_x.

◆ print()

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

Reimplemented in Polygon.

Definition at line 46 of file IShape2D.h.

46 { ostr << m_name; }
const char *const m_name
Definition: IShape2D.h:49

References IShape2D::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.

Member Data Documentation

◆ m_x

double VerticalLine::m_x
private

Definition at line 51 of file Line.h.

Referenced by clone(), contains(), and getXpos().

◆ m_name

const char* const IShape2D::m_name
privateinherited

Definition at line 49 of file IShape2D.h.

Referenced by IShape2D::print().


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