Skip to content
Snippets Groups Projects
Commit 7666a74e authored by Karsten Rink's avatar Karsten Rink
Browse files

more changes based on PR comments

parent 82458eee
No related branches found
No related tags found
No related merge requests found
......@@ -131,11 +131,14 @@ bool isPointInTriangle(GeoLib::Point const& p,
/**
* Tests if the given point p is located within a tetrahedron spanned by points a, b, c, d.
* If the tet specified by a, b, c, d is degenerated (i.e. all points are coplanar) the function
* will return false because there is no meaningful concept of "inside" for such elements.
* @param p test point
* @param a edge node of tetrahedron
* @param b edge node of tetrahedron
* @param c edge node of tetrahedron
* @param c edge node of tetrahedron
* @param d edge node of tetrahedron
* @param eps Accounts for numerical inaccuracies by allowing a point to be slightly outside of the element and still be regarded as inside.
* @return true if the test point p is not located outside of abcd (i.e. inside or on a plane/edge).
*/
bool isPointInTetrahedron(GeoLib::Point const& p, GeoLib::Point const& a, GeoLib::Point const& b,
......@@ -191,8 +194,8 @@ double scalarTriple(MathLib::Vector3 const& u, MathLib::Vector3 const& v, MathLi
* @param a first point on plane
* @param b second point on plane
* @param c third point on plane
* @return If the triangle abc is ordered counterclockwise when viewed from p, the method will return a value < 0,
* otherwise it will return > 0. If p is coplanar with abc, the function will return 0.
* @return If the triangle abc is ordered counterclockwise when viewed from p, the method will return a negative value,
* otherwise it will return a positive value. If p is coplanar with abc, the function will return 0.
*/
double orient3d(GeoLib::Point const& p,
GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c);
......
......@@ -165,4 +165,3 @@ bool Element::hasNeighbor(Element* elem) const
}
......@@ -161,7 +161,7 @@ public:
* @param eps tolerance for numerical algorithm used or computing the property
* @return true if the point is not outside the element, false otherwise
*/
virtual bool isPntInElement(GeoLib::Point const& pnt, double eps) const = 0;
virtual bool isPntInElement(GeoLib::Point const& pnt, double eps = std::numeric_limits<double>::epsilon()) const = 0;
/**
* Tests if the element is geometrically valid.
......
......@@ -94,7 +94,7 @@ void Mesh2MeshPropertyInterpolation::interpolatePropertiesForMesh(Mesh *dest_mes
for (size_t j(0); j<n_nodes_in_vec; j++) {
MeshLib::Node const*const j_th_node((*i_th_vec)[j]);
if (elem_aabb.containsPoint(*j_th_node)) {
if (dest_elements[k]->isPntInElement(* dynamic_cast<GeoLib::Point const*>(j_th_node), 30)) {
if (dest_elements[k]->isPntInElement(*j_th_node, 30)) {
dest_properties[k] += interpolated_src_node_properties[(*i_th_vec)[j]->getID()];
cnt++;
}
......
......@@ -56,6 +56,7 @@ TEST(IsPntInElement, Line)
ASSERT_EQ(false, line.isPntInElement(pnt));
deleteNodes(nodes);
}
TEST(IsPntInElement, Tri)
{
GeoLib::Point pnt;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment