World Builder
0.1.0-pre
A geodyanmic initial conditions generator
|
Classes | |
class | NaturalCoordinate |
Functions | |
bool | polygon_contains_point (const std::vector< Point< 2 > > &point_list, const Point< 2 > &point) |
double | signed_distance_to_polygon (const std::vector< Point< 2 > > &point_list, const Point< 2 > &point) |
std::array< double, 3 > | cartesian_to_spherical_coordinates (const Point< 3 > &position) |
Point< 3 > | spherical_to_cartesian_coordinates (const std::array< double, 3 > &scoord) |
CoordinateSystem | string_to_coordinate_system (const std::string &coordinate_system) |
template<int dim> | |
const std::array< double, dim > | convert_point_to_array (const Point< dim > &point_) |
double | string_to_double (const std::string &string) |
double | string_to_int (const std::string &string) |
double | string_to_unsigned_int (const std::string &string) |
boost::optional< std::string > | get_from_ptree (const ptree &tree, const std::string &path, const std::string &key, const bool required, const std::string &path_separator) |
boost::optional< std::string > | get_from_ptree_abs (const ptree &tree, const std::string &path, const std::string &key, const bool required, const std::string &path_separator) |
std::string | indent (int level) |
std::stringstream | print_tree (const ptree &pt, int level) |
template const std::array< double, 2 > | convert_point_to_array< 2 > (const Point< 2 > &point_) |
template const std::array< double, 3 > | convert_point_to_array< 3 > (const Point< 3 > &point_) |
std::array< double, 3 > | cartesian_to_ellipsoidal_coordinates (const Point< 3 > &position, const double semi_major_axis_a, const double eccentricity) |
Point< 3 > | ellipsoidal_to_cartesian_coordinates (const std::array< double, 3 > &phi_theta_d, const double semi_major_axis_a, const double eccentricity) |
std::array<double,3> WorldBuilder::Utilities::cartesian_to_ellipsoidal_coordinates | ( | const Point< 3 > & | position, |
const double | semi_major_axis_a, | ||
const double | eccentricity | ||
) |
Returns ellipsoidal coordinates of a Cartesian point. The returned array is filled with phi, theta and radius.
std::array< double, 3 > WorldBuilder::Utilities::cartesian_to_spherical_coordinates | ( | const Point< 3 > & | position | ) |
Returns spherical coordinates of a Cartesian point. The returned array is filled with radius, phi and theta (polar angle). If the dimension is set to 2 theta is omitted. Phi is always normalized to [0,2*pi].
Definition at line 283 of file utilities.cc.
const std::array< double, dim > WorldBuilder::Utilities::convert_point_to_array | ( | const Point< dim > & | point | ) |
Convert point to array
Definition at line 331 of file utilities.cc.
template const std::array<double,2> WorldBuilder::Utilities::convert_point_to_array< 2 > | ( | const Point< 2 > & | point_ | ) |
template const std::array<double,3> WorldBuilder::Utilities::convert_point_to_array< 3 > | ( | const Point< 3 > & | point_ | ) |
Point<3> WorldBuilder::Utilities::ellipsoidal_to_cartesian_coordinates | ( | const std::array< double, 3 > & | phi_theta_d, |
const double | semi_major_axis_a, | ||
const double | eccentricity | ||
) |
Return the Cartesian point of a ellipsoidal position defined by phi, phi and radius.
boost::optional< std::string > WorldBuilder::Utilities::get_from_ptree | ( | const ptree & | tree, |
const std::string & | path, | ||
const std::string & | key, | ||
const bool | required = true , |
||
const std::string & | path_separator = "." |
||
) |
Returns a value from the property tree and asserts with the path and value in the error message when the value was not present.
Definition at line 410 of file utilities.cc.
boost::optional< std::string > WorldBuilder::Utilities::get_from_ptree_abs | ( | const ptree & | tree, |
const std::string & | path, | ||
const std::string & | key, | ||
const bool | required = true , |
||
const std::string & | path_separator = "." |
||
) |
Returns a value from the property tree and asserts with the path and value in the error message when the value was not present.
Definition at line 423 of file utilities.cc.
std::string WorldBuilder::Utilities::indent | ( | int | level | ) |
This is a helper function for print tree which helps with indenting the entries based on their nesting level
Definition at line 447 of file utilities.cc.
bool WorldBuilder::Utilities::polygon_contains_point | ( | const std::vector< Point< 2 > > & | point_list, |
const Point< 2 > & | point | ||
) |
Given a 2d point and a list of points which form a polygon, computes if the point falls within the polygon.
This code has been based on http://geomalgorithms.com/a03-_inclusion.html, and therefore requires the following copyright notice:
Copyright 2000 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application.
The main functional difference between the original code and this code is that all the boundaries are considered to be inside the polygon. One should of course realize that with floating point arithmetic no guarantees can be made for the borders, but for exact arithmetic this algorithm would work (also see polygon in point test).
Definition at line 32 of file utilities.cc.
std::stringstream WorldBuilder::Utilities::print_tree | ( | const ptree & | pt, |
int | level | ||
) |
This function prints a boost property tree as a json type file to the screen.
Definition at line 454 of file utilities.cc.
double WorldBuilder::Utilities::signed_distance_to_polygon | ( | const std::vector< Point< 2 > > & | point_list_, |
const Point< 2 > & | point_ | ||
) |
Given a 2d point and a list of points which form a polygon, compute the smallest distance of the point to the polygon. The sign is negative for points outside of the polygon and positive for points inside the polygon.
This code is based on http://geomalgorithms.com/a02-_lines.html#Distance-to-Infinite-Line, and therefore requires the following copyright notice:
Copyright 2000 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for their application.
Definition at line 132 of file utilities.cc.
Point< 3 > WorldBuilder::Utilities::spherical_to_cartesian_coordinates | ( | const std::array< double, 3 > & | scoord | ) |
Return the Cartesian point of a spherical position defined by radius, phi and theta (polar angle). If the dimension is set to 2 theta is omitted.
Definition at line 301 of file utilities.cc.
CoordinateSystem WorldBuilder::Utilities::string_to_coordinate_system | ( | const std::string & | ) |
A function that takes a string representation of the name of a coordinate system (as represented by the CoordinateSystem enum) and returns the corresponding value.
Definition at line 316 of file utilities.cc.
double WorldBuilder::Utilities::string_to_double | ( | const std::string & | string | ) |
Converts a string to a double
Definition at line 340 of file utilities.cc.
double WorldBuilder::Utilities::string_to_int | ( | const std::string & | string | ) |
Converts a string to a int
Definition at line 363 of file utilities.cc.
double WorldBuilder::Utilities::string_to_unsigned_int | ( | const std::string & | string | ) |
Converts a string to a unsigned int
Definition at line 387 of file utilities.cc.