Skip to content

Commit

Permalink
Merge pull request #1727 from DGtal-team/rawWinding
Browse files Browse the repository at this point in the history
Exposing winding number values
  • Loading branch information
dcoeurjo authored Jun 1, 2024
2 parents 2535dc6 + 65b0fe0 commit 7ff5729
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
4 changes: 3 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
- Add method to remove isolated vertices in Mesh, improve obj
material reading from potential obsolete path. (Bertrand Kerautret,
[#1709](https://github.com/DGtal-team/DGtal/issues/1709))
- Update of the WindingNumber constructor to allow external computation of point areas
- Update of the WindingNumberShape constructor to allow external computation of point areas
(David Coeurjolly,[#1719](https://github.com/DGtal-team/DGtal/issues/1719))
- the WindingNumberShape class can output the raw winding number values
(David Coeurjolly,[#1719](https://github.com/DGtal-team/DGtal/issues/1719))


Expand Down
28 changes: 20 additions & 8 deletions src/DGtal/shapes/WindingNumbersShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,9 @@ namespace DGtal
{
Eigen::VectorXd W;
std::vector<Orientation> results( queries.rows(), DGtal::OUTSIDE );
Eigen::MatrixXd O_CM;
Eigen::VectorXd O_R;
Eigen::MatrixXd O_EC;

//Checking if the areas
igl::fast_winding_number(*myPoints,*myNormals,myPointAreas,myO_PI,myO_CH,2,O_CM,O_R,O_EC);
igl::fast_winding_number(*myPoints,*myNormals,myPointAreas,myO_PI,myO_CH,O_CM,O_R,O_EC,queries,2,W);


rawWindingNumberBatch(queries, W);

//Reformating the output
for(auto i=0u; i < queries.rows(); ++i)
{
Expand All @@ -194,6 +189,23 @@ namespace DGtal
return results;
}


/// Returns the raw value of the Winding Number funciton at a set of points (queries).
///
/// @param queries [in] a "nx3" matrix with the query points in space.
/// @param W [out] a vector with all windung number values.
void rawWindingNumberBatch(const Eigen::MatrixXd & queries,
Eigen::VectorXd &W) const
{
Eigen::MatrixXd O_CM;
Eigen::VectorXd O_R;
Eigen::MatrixXd O_EC;

//Checking if the areas
igl::fast_winding_number(*myPoints,*myNormals,myPointAreas,myO_PI,myO_CH,2,O_CM,O_R,O_EC);
igl::fast_winding_number(*myPoints,*myNormals,myPointAreas,myO_PI,myO_CH,O_CM,O_R,O_EC,queries,2,W);
}

///Const alias to the points
CountedConstPtrOrConstPtr<Eigen::MatrixXd> myPoints;
///Const alias to the normals
Expand Down

0 comments on commit 7ff5729

Please sign in to comment.