Skip to content

Commit

Permalink
Added missing PCK::aligned_3d predicate for points with expansion_nt
Browse files Browse the repository at this point in the history
as coordinates.
  • Loading branch information
BrunoLevy committed Nov 7, 2023
1 parent 8c0ec94 commit 8abdaea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/lib/geogram/mesh/mesh_surface_intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,6 @@ namespace GEO {
// Sanity check
if(false) {
Attribute<bool> selected(mesh_.facets.attributes(), "selection");

for(index_t t: mesh_.facets) {
if(PCK::aligned_3d(
exact_vertex(mesh_.facets.vertex(t,0)),
Expand Down
14 changes: 14 additions & 0 deletions src/lib/geogram/numerics/exact_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,20 @@ namespace GEO {
geo_assert(Nz.sign() != ZERO);
return 2;
}

bool aligned_3d(
const vec3HE& p0, const vec3HE& p1, const vec3HE& p2
) {
// TODO: filter if need be
vec3HE U = p1-p0;
vec3HE V = p2-p0;
return (
det2x2(U.x,V.x,U.y,V.y).sign() == ZERO &&
det2x2(U.y,V.y,U.z,V.z).sign() == ZERO &&
det2x2(U.z,V.z,U.x,V.x).sign() == ZERO
);
}

}

/*****************************************************************/
Expand Down
13 changes: 12 additions & 1 deletion src/lib/geogram/numerics/exact_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,18 @@ namespace GEO {
coord_index_t GEOGRAM_API triangle_normal_axis(
const vec3& p1, const vec3& p2, const vec3& p3
);


/**
* \brief Tests whether three 3d points are aligned
* \param(in] p0 , p1 , p2 the three points,
* in homogeneous coordinates, represented in exact form.
* \retval true if the three points are aligned (or if two
* of them or more are identical)
* \retval false otherwise
*/
bool GEOGRAM_API aligned_3d(
const vec3HE& p0, const vec3HE& p1, const vec3HE& p2
);
}

/************************************************************************/
Expand Down

0 comments on commit 8abdaea

Please sign in to comment.