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

Public Types

typedef model::d2::point_xy< double > point_t
 
typedef model::polygon< point_tpolygon_t
 

Public Member Functions

void init_from (const std::vector< double > &x, const std::vector< double > &y)
 
void get_points (std::vector< double > &xpos, std::vector< double > &ypos)
 

Public Attributes

polygon_t polygon
 

Detailed Description

The private data for polygons to hide boost dependency from the header.

Definition at line 26 of file Polygon.cpp.

Member Typedef Documentation

◆ point_t

typedef model::d2::point_xy<double> PolygonPrivate::point_t

Definition at line 29 of file Polygon.cpp.

◆ polygon_t

typedef model::polygon<point_t> PolygonPrivate::polygon_t

Definition at line 30 of file Polygon.cpp.

Member Function Documentation

◆ init_from()

void PolygonPrivate::init_from ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

Definition at line 36 of file Polygon.cpp.

37 {
38  if (x.size() != y.size())
40  "Polygon::Polygon(const std::vector<double>& x, const std::vector<double>& y) "
41  "Error. Sizes of arrays must conincide.");
42  std::vector<point_t> points;
43  for (size_t i = 0; i < x.size(); ++i)
44  points.push_back(point_t(x[i], y[i]));
45  assign_points(polygon, points);
46  correct(polygon);
47 }
model::d2::point_xy< double > point_t
Definition: Line.cpp:25
polygon_t polygon
Definition: Polygon.cpp:31

Referenced by Polygon::Polygon().

◆ get_points()

void PolygonPrivate::get_points ( std::vector< double > &  xpos,
std::vector< double > &  ypos 
)

Definition at line 49 of file Polygon.cpp.

50 {
51  xpos.clear();
52  ypos.clear();
53  for (auto it = polygon.outer().begin(); it != polygon.outer().end(); ++it) {
54  // for vectors of x and y, extract the x/y from the point
55  xpos.push_back(boost::geometry::get<0>(*it));
56  ypos.push_back(boost::geometry::get<1>(*it));
57  }
58 }

Referenced by Polygon::getPoints().

Member Data Documentation

◆ polygon

polygon_t PolygonPrivate::polygon

Definition at line 31 of file Polygon.cpp.

Referenced by Polygon::contains(), Polygon::getArea(), and Polygon::print().


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