bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
kernel::discretization::utils Namespace Reference

Functions

template<typename ElementTp >
const kernel::GeomPoint< ElementTp::dimension > find_point_on_element_closest_to (const ElementTp &element, const GeomPoint< ElementTp::dimension > &p, uint_t nsamples, real_t tol)
 
template<typename ElementTp >
real_t distance_from (const ElementTp &element, const GeomPoint< ElementTp::dimension > &p, uint_t nsamples, real_t tol)
 
template<typename MeshTp >
const MeshTp::element_t * find_closest_element (const MeshTp &mesh, const GeomPoint< MeshTp::dimension > &p, uint_t nsamples, real_t tol)
 Find the element in the mesh with the smallest distance from the point.
 
template<typename MeshTp >
std::tuple< const typename MeshTp::point_t, const typename MeshTp::element_t * > find_closest_point_to (const MeshTp &mesh, const GeomPoint< 2 > &p, uint_t nsamples, real_t tol)
 
template<typename MeshTp >
const std::vector< typename MeshTp::point_t > find_intersections (const MeshTp &mesh, const Circle &circle)
 Returns the intersection points of the Circle with the elements of the LineMesh. The algorithn implemented is the one described here https://stackoverflow.com/questions/1073336/circle-line-segment-collision-detection-algorithm/1084899#1084899%E2%80%8B.
 

Function Documentation

◆ distance_from()

template<typename ElementTp >
real_t kernel::discretization::utils::distance_from ( const ElementTp &  element,
const GeomPoint< ElementTp::dimension > &  p,
uint_t  nsamples,
real_t  tol 
)

◆ find_closest_element()

template<typename MeshTp >
const MeshTp::element_t * kernel::discretization::utils::find_closest_element ( const MeshTp &  mesh,
const GeomPoint< MeshTp::dimension > &  p,
uint_t  nsamples,
real_t  tol 
)

Find the element in the mesh with the smallest distance from the point.

◆ find_closest_point_to()

template<typename MeshTp >
std::tuple< const typename MeshTp::point_t, const typename MeshTp::element_t * > kernel::discretization::utils::find_closest_point_to ( const MeshTp &  mesh,
const GeomPoint< 2 > &  p,
uint_t  nsamples,
real_t  tol 
)

find out to which segment this point belongs to

◆ find_intersections()

template<typename MeshTp >
const std::vector< typename MeshTp::point_t > kernel::discretization::utils::find_intersections ( const MeshTp &  mesh,
const Circle &  circle 
)

Returns the intersection points of the Circle with the elements of the LineMesh. The algorithn implemented is the one described here https://stackoverflow.com/questions/1073336/circle-line-segment-collision-detection-algorithm/1084899#1084899%E2%80%8B.

thats an intersection point

◆ find_point_on_element_closest_to()

template<typename ElementTp >
const kernel::GeomPoint< ElementTp::dimension > kernel::discretization::utils::find_point_on_element_closest_to ( const ElementTp &  element,
const GeomPoint< ElementTp::dimension > &  p,
uint_t  nsamples,
real_t  tol 
)

...plus 2 because we also account for the end poinst

the first point is the staring vertex

the first point is the staring vertex

we have line that is perpendicular to the x-axis and we need to act differently to avoid infinity

we have line that is parallel to the x-axis and we need to act differently to avoid infinity

calculate the coefficients of the line connecting the two vertices

add the ending vertex of the line segment