BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
VerticalLine Class Reference

An infinite vertical line. More...

Inheritance diagram for VerticalLine:
[legend]
Collaboration diagram for VerticalLine:
[legend]

Public Member Functions

 VerticalLine (double x)
 
VerticalLineclone () const
 
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...
 
bool contains (double x, double y) const
 Returns true if point with given coordinates is inside or on border of the shape. More...
 
double getXpos () 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

const char *const m_name
 
double m_x
 

Detailed Description

An infinite vertical line.

Definition at line 38 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:49

Referenced by clone().

Member Function Documentation

◆ clone()

VerticalLine* VerticalLine::clone ( ) const
inlinevirtual

Implements IShape2D.

Definition at line 41 of file Line.h.

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

References VerticalLine(), and m_x.

Here is the call graph for this function:

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

◆ contains() [2/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:34

References algo::almostEqual(), and m_x.

Here is the call graph for this function:

◆ getXpos()

double VerticalLine::getXpos ( ) const
inline

Definition at line 46 of file Line.h.

46 { 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_name

const char* const IShape2D::m_name
privateinherited

Definition at line 49 of file IShape2D.h.

Referenced by IShape2D::print().

◆ m_x

double VerticalLine::m_x
private

Definition at line 49 of file Line.h.

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


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