Skip to content

Conversation

@Levi-Armstrong
Copy link
Contributor

@Levi-Armstrong Levi-Armstrong commented Sep 17, 2017

A implementation of a advancing front surface reconstruction algorithm based on the following papers.

Advancing Front Papers

  1. High-Quality Extraction of Isosurfaces from Regular and Irregular Grids
    J. Schreiner, C. Scheidegger, C. Silva
    IEEE Transactions on Visualization and Computer Graphics (Proceedings of IEEE Visualization); 2006

  2. Direct (Re)Meshing for Efficient Surface Processing
    J. Schreiner, C. Scheidegger, S. Fleishman, C. Silva
    Computer Graphics Forum (Proceedings of Eurographics); 2006

  3. Triangulating Point-Set Surfaces With Bounded Error
    C. Scheidegger, S. Fleishman, C. Silva
    Proceedings of the third Eurographics/ACM Symposium on Geometry Processing; 2005

Testing
pcl_advancing_front_reconstruction bun0.pcd bun0.ply -radius 0.05 -rho 0.6

Debug interface
In cmake gui enable BUILD_surface_afront_debug and rebuild. When running the command above a pcl viewer window will open and press numbers 0-9 to generated 10^x triangles.

Maintainers
This includes commits from the PR #1960. I planned on waiting for the PR to be merged before submitting this, but my budget goes away at the end of this month so I wanted to get this submitted before then.

Images

@taketwo
Copy link
Member

taketwo commented Sep 20, 2017

Hi, thanks again for contributing. This PR is particularly hard to deal with: a complex algorithm implemented in some 3.5K lines of code. I'm no expert in meshing in general and this algorithm in particular, so I won't be able to assess this code in terms of how well it implements the papers. Further, even thoroughly checking the logic and exploring refactoring possibilities is well beyond what I can realistically do. Therefore, in my review I will concentrate on making sure that the overall code style is in the PCL spirit.

So far I have only scanned the code. Here are initial suggestions:

  • Class name. I'd prefer to spell out the "advanced" completely.
  • File names. Should match class name, but in snake_case, of course.
  • License. It's alright to have your employer in the copyright, but please also add a line for Open Perception.
  • Debugging visualization. I can imagine it was quite helpful during development and I acknowledge that it is incredibly instructive for understanding how the algorithm works. However, I think we should not include it in the class, even if carefully isolated with macro guards.

My next step will be reviewing the advancing_front_utils.h file. Some of the functions there are already present in PCL, some may be handy for other users and thus may be moved to the common module. So, ideally, I would like to see this file dissolving.

{

/** \brief Align pn's normal with av so they point in the same direction */
bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need return type? I don't see you ever using it.


/** \brief Align pn's normal with av so they point in the same direction */
bool
alignNormal (Eigen::Vector3f &pn, const Eigen::Vector3f &av)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe alignNormals?

bool
alignNormal (Eigen::Vector3f &pn, const Eigen::Vector3f &av)
{
double dot = pn.dot (av);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to upcast to double. And in general, this function can be reduced to:

if (pn.dot (av) < 0.0f)
  pn *= -1;

bool
alignNormal (AfrontVertexPointType &pn, const AfrontVertexPointType &av)
{
Eigen::Vector3f normal = pn.getNormalVector3fMap ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should work if you pass pn.getNormalVector3fMap () directly to the alignNormal function, the underlying data should be modified.

I'd move these two functions and the next one (checkNormal) to the common module. I don't really see any existing header file there that would naturally fit them, so propose to create a new one "normals.h".

While doing so, I'd make alignNormals templated on the point types, something like:

template <typename PointNT1, typename PointNT2>
alignNormals (PointNT1& pn, const PointNT2& av)

to ensure reusability.


/** \brief Check if two normals are within a tolerance */
bool
checkNormal (const Eigen::Vector3f n1, const Eigen::Vector3f n2, const double &tol)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps checkNormalsEqual?
tol -> angular_threshold
It also makes sense to mention in the docstring that the threshold is in radians.

}

AfrontGuidanceFieldPointType
convertAfrontPointTypeToAfrontGuidanceFieldPointType (const AfrontVertexPointType &p, const double rho)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only used in one place, so may be moved directly there. Alternatively, make this a member function of the vertex point type.

* \return The mid point of the half edge
*/
Eigen::Vector3f
getMidPoint (const Eigen::Vector3f &p1, const Eigen::Vector3f &p2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really trivial and is only used in two places, I'd simply expand this at the points of usage.

* \return DistPoint2LineResults
*/
DistPoint2LineResults
distPoint2Line (const Eigen::Vector3f &p1, const Eigen::Vector3f &p2, const Eigen::Vector3f &p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a point to line distance function in common in "distances.h" can we reuse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like they are for checking against a line with infinite length, where I need to check against a line segment. Should I add these to this file? I would rename the methods to:

distPointToLineSeg
distLineSegToLineSeg

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please. I'd spell "segment" completely, and also move "distance" part to the end to be similar with already existing function names, i.e. pointToLineSegmentDistance and lineSegmentToLineSegmentDistance. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

* \return DistLine2LineResults
*/
DistLine2LineResults
distLine2Line (const Eigen::Vector3f &p1, const Eigen::Vector3f &p2, const Eigen::Vector3f &p3, const Eigen::Vector3f &p4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we integrate this into aforementioned header file?

* \return IntersectionLine2PlaneResults
*/
IntersectionLine2PlaneResults
intersectionLine2Plane (const Eigen::Vector3f &p1, const Eigen::Vector3f &p2, const Eigen::Vector3f &origin, const Eigen::Vector3f &u, const Eigen::Vector3f &v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a function to compute line with plane intersection in common module "intersections.h" file. Can we reuse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only see lineWithLineIntersection and planeWithPlaneIntersection but no lineWithPlaneIntersection. Is it located somewhere else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my bad. Can we add your function there, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK good. I will move the function to the intersection.h file.

@SergioRAgostinho
Copy link
Member

#1960 was merged so let's rebase this one to remove the redundant commits.

@SergioRAgostinho SergioRAgostinho self-assigned this Sep 22, 2017
@moriarty
Copy link
Contributor

Hey @taketwo, I just saw this mentioned in a talk at ROSCon, I agree with your first comment- this is hard to review.

I just thought I'd mention the ROSCon talk video should be available either now or soon.

@taketwo
Copy link
Member

taketwo commented Sep 23, 2017

Hi Alex, after having read your comment several times, I'm still not sure what was mentioned in the ROSCon talk and what relation it has with this PR. But I'm intrigued, please post a link when it's online ;)

@moriarty
Copy link
Contributor

Yes, I was in the talk when I commented above.
I'll post a link when it's online, it was available via live stream, but now we wait for Ubuntu to upload the videos and they expect it to take a month.

The talk gave a bit of a explaination, showed some results and then mentioned that it would be available soon as the PR was being reviewed. The results looked good and useful so I checked it out during the talk.

@taketwo, I saw your comment that it's hard to check the algorithm, and that you'd just review if the code was in the style of PCL, so I thought it would be helpful to see the results. Maybe @Levi-Armstrong can link to results somewhere.

@Levi-Armstrong
Copy link
Contributor Author

Sure, the results I presented are shown here. I am currently traveling back from ROSCon 2017 and on Monday I will begin addressing the comments above.

@taketwo taketwo added needs: code review Specify why not closed/merged yet needs: author reply Specify why not closed/merged yet labels Sep 26, 2017
@SergioRAgostinho
Copy link
Member

FYI: I'm starting to look at this again.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a first review which focuses only on CMake related code.

#ifndef PCL_SURFACE_ADVANCING_FRONT_H_
#define PCL_SURFACE_ADVANCING_FRONT_H_

#define PCL_NO_PRECOMPILE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is normally not a good policy. What forces you to define this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was left over from when I was developing outside pcl. I was getting errors related to my custom point type when using them with other libraries like mls and kdtree, but when I added the define they all went away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not registering your point type in point_types.h[pp] like all the others? Looking at the points included there I would say yours is a perfectly eligible candidate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a support point type for this specific algorithm. What use will it have outside?
Added deficit: will increase build time and binary sizes due to additional template instantiations for all PCL algorithms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plan was to only be used by this algorithm. I need to cache additional information for each point in the mesh to support the mesher, but there should not be any use for it outside of this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense. Let's keep it then.


option(BUILD_tools "Useful PCL-based command line tools" ON)

option(BUILD_surface_afront_debug "Enable afront mesher debug interface" OFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be added here. At this level there's no guarantee that the surface module will be built, therefore makes no sense to show this here.

Note to self: I have a comment stating that the debug interface should be limited to a tool

ENDIF(BUILD_surface_on_nurbs)

IF(BUILD_surface_afront_debug)
add_definitions(-DAFRONTDEBUG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to see how this is implemented but in general I would prefer to not add definitions. Is there an easy way to avoid this?

else(BUILD_surface_afront_debug)
target_link_libraries("${LIB_NAME}" pcl_common pcl_search pcl_kdtree pcl_octree ${VTK_LIBRARIES} ${ON_NURBS_LIBRARIES})
endif(BUILD_surface_afront_debug)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see how things are done for QHull in line 180, that's how you should link with VTK. Move your condition below line 194.

set(SUBSYS_DEPS common search kdtree octree geometry visualization)
else(BUILD_surface_afront_debug)
set(SUBSYS_DEPS common search kdtree octree geometry)
endif(BUILD_surface_afront_debug)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the perfect file to define your BUILD_surface_afront_debug option. But this block needs to move below line 15, since if the surface module is not build, this option should not pop-up.

You're adding a dependency to geometry which in turn only depends of common. geometry has a number of meshing primitives so I would say that functionally this dependency makes sense. To be checked is exactly what you use from there.

Your conditional branch should not set SUBSYS_DEPS directly, it should just append the visualization dependency to it. I want the module mandatory dependencies to appear on top first, isolated from whatever options the user decides later down the road, in case the surfacemodule is built

if (BUILD_io AND BUILD_features)
IF(BUILD_surface_afront_debug)
add_definitions(-DAFRONTDEBUG)
ENDIF(BUILD_surface_afront_debug)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping in mind my comment of adding definitions, you should not need to add this here as well. It should come exported the moment you link with the surface target.

if (BUILD_tools)
IF(BUILD_surface_afront_debug)
add_definitions(-DAFRONTDEBUG)
ENDIF(BUILD_surface_afront_debug)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before

@Levi-Armstrong
Copy link
Contributor Author

FYI: I should be able to start addressing the open items this week.

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Oct 17, 2017

Thanks. Let's address things by stages, starting with just CMake related issues at first. If possible leave each review stage on it's own commit to make it easier to traverse the history of changes.

@taketwo
Copy link
Member

taketwo commented Oct 18, 2017

Some of the CMake issues are related to debug visualization. As I wrote early on, I think we should just get rid of it. What's your stance on this?

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Oct 18, 2017

I was wondering if we could refactor that code and use it as a tool.

I had a "similar" situation in the past, when I wrote a tracker class, and (of course) found out at some point that it was necessary to inject some more code to aid in understanding what was happening with the tracker. My solution for that was to derive a child class of the tracker to work as a debugger of what was going. The debugger was working as the middle man, wrapping all calls to the parent while having access to the protected members.

In this case, the debugger class would only reside in the tools module, alongside an application which invokes it. I was wondering if such strategy could be applied here as well.

@taketwo
Copy link
Member

taketwo commented Oct 19, 2017

This sounds like a reasonable thing to do, although will require extra effort from Levi.

@Levi-Armstrong
Copy link
Contributor Author

I will see what I can do. I believe this would be good to have since the paper mentions advanced techniques for reconstructing sharp edges where the tool would be useful for implementing this in the future.

@SergioRAgostinho
Copy link
Member

Thanks! Then I would suggest to pull the visualization code/tool for another PR, and for now strip this one of everything related to that. Does it sound reasonable? I'll try to go through another review stage in the upcoming days.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2nd review focused on the new point type you're defining.

*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2017-, Southwest Research Institute
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Sergey already mentioned this somewhere else but you need to add Open Perception here as well.

#define PCL_SURFACE_ADVANCING_FRONT_POINT_TYPE_H_

#include <pcl/point_types.h>
#include <pcl/register_point_struct.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not be required, since it's already included by point_types.h


#include <pcl/point_types.h>
#include <pcl/register_point_struct.h>
#include <pcl/impl/instantiate.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required here? There's nothing on this file which makes instantiations.


namespace pcl
{
namespace afront
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this extra namespace is required. You're already naming everything Afront....

curvature = p.curvature;
max_step = p.max_step;
max_step_search_radius = p.max_step_search_radius;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you required to define this? This looks like the default copy constructor and the compiler should generate one for you automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that most of the existing if not all did this so I assumed that there was a reason behind it. Let me know if you would like it removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. 👍 There's a couple of things that happen if you define the copy constructor, because intuitively you're telling the compiler "Wait. My copy process is more complex than usual" and the compiler won't generate a couple of useful methods for you in that case. See https://stackoverflow.com/questions/3734247/what-are-all-the-member-functions-created-by-compiler-for-a-class-does-that-hap#3734268 for more info.

friend std::ostream &
operator<< (std::ostream &os, const AfrontVertexPointType &p)
{
os << p.x << "\t" << p.y << "\t" << p.z;
Copy link
Member

@SergioRAgostinho SergioRAgostinho Oct 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should actually print all your point type's internal members.

data_n[3] = 0.0f;
curvature = p.curvature;
ideal_edge_length = p.ideal_edge_length;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before.

friend std::ostream &
operator<< (std::ostream &os, const AfrontGuidanceFieldPointType &p)
{
os << p.x << "\t" << p.y << "\t" << p.z;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before.

} // namespace afront
} // namespace pcl
POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::afront::AfrontVertexPointType,
(float, x, x) (float, y, y) (float, z, z) (float, normal_x, normal_x) (float, normal_y, normal_y) (float, normal_z, normal_z) (float, curvature, curvature) (float, max_step, max_step) (float, max_step_search_radius, max_step_search_radius))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you span this over multiple lines to increase readability? Each field on each line.

(float, x, x) (float, y, y) (float, z, z) (float, normal_x, normal_x) (float, normal_y, normal_y) (float, normal_z, normal_z) (float, curvature, curvature) (float, max_step, max_step) (float, max_step_search_radius, max_step_search_radius))

POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::afront::AfrontGuidanceFieldPointType,
(float, x, x) (float, y, y) (float, z, z) (float, normal_x, normal_x) (float, normal_y, normal_y) (float, normal_z, normal_z) (float, curvature, curvature) (float, ideal_edge_length, ideal_edge_length))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

@SergioRAgostinho SergioRAgostinho added the changelog: new feature Meta-information for changelog generation label Nov 6, 2017
@Levi-Armstrong Levi-Armstrong force-pushed the addAfrontMesher branch 2 times, most recently from 9096172 to b50bcea Compare November 15, 2017 13:17
Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only had time to review the functions you added to common/distance.

Also, there's still a number of warnings being printed in Travis that need to be suppressed.

"include/pcl/${SUBSYS_NAME}/texture_mapping.h"
"include/pcl/${SUBSYS_NAME}/poisson.h"
"include/pcl/${SUBSYS_NAME}/advancing_front.h"
"include/pcl/${SUBSYS_NAME}/advancing_front_point_type.h"
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that it might not be worth to have a separate header for this. To decide later in a future review.

Eigen::Vector3f p; /**< \brief The closest point on line segment. */
float mu; /**< \brief The corresponding line paramentric value resulting in the minimum distance. */
double d; /**< \brief The distance between point and line segments */
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to define this PointToLineSegmentDistanceResults type. I'll suggest a different function signature for pointToLineSegmentDistance and delete this definition altogether.

else if (c2 <= c1)
results.mu = 1.0;
else
results.mu = c1 / c2;
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes no sense to clamp mu between 0 and 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is measuring the distance between a point and a Line segment. Example for the case of triangle edge, I need to know the distance from a point to a line segment so mu must be clamped between 0 and 1 to get the correct distance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this function will be used for more than your triangular case, so that check needs to be done a posteriori.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine as long as the function return mu I can check it in my code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then again, the name of the function is distance to line segment and not really distance to line.

@taketwo opinion: Should we allow the option of clamping as a parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option could be to modify the existing sqrPointToLineDistance to calculate mu. Then I can get the information I need if that simplifies things.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh true, that methods exists! Then my comment makes no sense. I'll delete/strike through everything which is not longer valid.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clamping please use a combination of std::max and std::min

results.mu = c1 / c2;

results.p = results.points[0] + results.mu * v;
results.d = (p - results.p).norm ();
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If mu is clamped this distance is incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation above.

* \param[in] p2 Terminating point of the line
* \param[in] p The point for calulating the distance to the line
* \return DistPoint2LineResults
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be defined inline and should not be in the header. Create distances.cpp, add the corresponding entry in the CMake file and move it there.

result.parallel = true;

dist = pointToLineSegmentDistance (p1, p2, p3);
result.mu[0] = dist.mu;
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only need to compute the point to line segment once because they're parallel. In this situation, you should set both mus and the corresponding interception points to NaN

else
{
result.mu[0] = (d1343 * d4321 - d1321 * d4343) / denom;
result.mu[1] = (d1343 + result.mu[0] * d4321) / d4343;
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to my calculations this should be

mu0 =  (d4343 * d1321 - d4321* d1343) /det;
mu1 =  (d4321 * d1321 - d2121* d1343) /det;

Edit: Forgot the determinant. Now the expressions look the same.

if (result.mu[1] > 1.0)
result.mu[1] = 1.0;
else if (result.mu[1] < 0.0)
result.mu[1] = 0.0;
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like before, these clampings make no sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the combination of std::min and std::max

result.mu[1] = 0.0;

result.p[0] = p1 + result.mu[0] * (p2 - p1);
result.p[1] = p3 + result.mu[1] * (p4 - p3);
Copy link
Member

@SergioRAgostinho SergioRAgostinho Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes no sense if the mus are clamped.


result.d = (result.p[1] - result.p[0]).norm ();
return result;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here as before in pointToLineSegmentDistance. Move the function to a cpp file, change the signature in the same way and make the corresponding overload.

@SergioRAgostinho SergioRAgostinho added needs: more work Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet needs: author reply Specify why not closed/merged yet labels Nov 22, 2017
@SergioRAgostinho
Copy link
Member

Update the comments. After the discussion, the target now is only changes in the functions signatures and the moving to a normal .cpp file.

Copy link
Member

@taketwo taketwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far we've been dealing with the helper functions, not the algorithm proper, and the conversation has already 92 comments. To make this more digestable, would it make sense to branch out the meshing class and tool into a separate PR? And here keep only helpers and their tests?


}

#include <pcl/common/impl/normals.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of these functions are templated, so should go into src/normals.cpp.


namespace pcl
{
/** \brief Align pn's normal with av so they point in the same direction */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add explanation of what is returned, not obvious.

{
/** \brief Align pn's normal with av so they point in the same direction */
bool
alignNormals (Eigen::Ref<Eigen::Vector3f> pn, const Eigen::Ref<const Eigen::Vector3f> &av);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently Eigen::Ref<> is the right way to take Eigen objects by reference, but it is not how it is done in PCL. I would be okay if you consistently used this style through the contribution, but it's not the case. Thus I'd propose to switch to "standard" reference to avoid confusing users.

@stale
Copy link

stale bot commented Apr 16, 2018

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Apr 16, 2018
@Micalson
Copy link
Contributor

@Levi-Armstrong Hi, I find the pull request about "A implementation of a advancing front surface reconstruction algorithm based on the following papers." But I cannot find the function in pcl repo.
I want to use the advancing front surface reconstruction algorithm, where could I find it? Thank you for your reply.

Regards,

@stale stale bot removed the status: stale label May 27, 2019
@Levi-Armstrong
Copy link
Contributor Author

@Micalson The only way to use it currently, is to build my branch in this PR to be able to leverage this meshing algorithm at them moment. I need to wrap up a few things before this can be merged, but I wanted to fix one know issue at the moment. It currently sometimes will wrap on its self. I believe I have a solution but I have not had time to implement and test. If you run into any issues let me know.

@Micalson
Copy link
Contributor

@Levi-Armstrong I get it. Thanks for your reply.

@stale
Copy link

stale bot commented Jul 29, 2019

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Jul 29, 2019
@stale
Copy link

stale bot commented Oct 30, 2019

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

@stale stale bot added the status: stale label Oct 30, 2019
@stale
Copy link

stale bot commented Feb 21, 2020

This pull request has been automatically marked as stale because it hasn't had
any activity in the past 60 days. Commenting or adding a new commit to the
pull request will revert this.

Come back whenever you have time. We look forward to your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: new feature Meta-information for changelog generation needs: more work Specify why not closed/merged yet status: stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants