Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates Qhull to 2015.2 using the C++ interface #1565

Closed
wants to merge 1 commit into from

Conversation

fran6co
Copy link
Contributor

@fran6co fran6co commented Mar 6, 2016

The old qhull had problems with multi threading (reentrant variant of the library) and outputing stuff to the stderr/stdout. This fixes all that and updates the interface to something a bit more usable.

Removed support to previous versions, not sure what's the best way to keep those. I was thinking of creating a different version of the impl files and include them depending on the version.

Depends on #1567

Closes #1618

@fran6co fran6co force-pushed the qhull branch 3 times, most recently from 331d309 to 7ffbf6c Compare March 7, 2016 22:51
@fran6co
Copy link
Contributor Author

fran6co commented Mar 7, 2016

The C++ interface needs the library to be linked statically, it crashes otherwise.

@fran6co fran6co force-pushed the qhull branch 4 times, most recently from 73be4dd to ebd3468 Compare March 8, 2016 15:51
@fran6co
Copy link
Contributor Author

fran6co commented Mar 8, 2016

The method computeMeanAndCovarianceMatrix does the wrong covariance calculation for some reason. I'm investigating what's wrong with it.

@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Jul 6, 2017

I don't know what to do with this PR.

Things changed a little bit on our CI we don't manually build dependencies any more (for now), because there's not enough time. You would need to precache it in a different stage.

The reentrant version of qHull was introduced only in 2015.
Ubuntu Precise 12.04 - is running 2009
Ubuntu Trusty 14.04 - is running 2012
Ubuntu Xenial 16.04 - is running 2015.2
Homebrew (OS X) - is running 2015.2 (no surprises there :p)
Windows - @UnaNancyOwen which version of QHull are you bundling in your All-In-One? is being bundled with 2015.2 in the all in one

I also cant' find ppas with backport for Precise and Trust :/

@UnaNancyOwen
Copy link
Member

@SergioRAgostinho The all-in-one installer for Windows bundles QHull 2015.2.

@jspricke
Copy link
Member

jspricke commented Jul 6, 2017

I can try to do backports as ppa this evening.

@SergioRAgostinho
Copy link
Member

Thanks for that Jochen. But even so, are we committing to stop supporting qhull prior to 2015?

@jspricke
Copy link
Member

jspricke commented Jul 6, 2017

I made some for precise i386 and trusty: https://launchpad.net/~v-launchpad-jochen-sprickerhof-de/+archive/ubuntu/pcl18. precise amd64 is failing.

Also I'm fine with updateing to the newer qhull version

@taketwo
Copy link
Member

taketwo commented Jul 7, 2017

But even so, are we committing to stop supporting qhull prior to 2015?

This is a tough one. We do not have an official baseline for our dependencies and we do not have a clear procedure how to lift it, if needed. We do not even have a "mission" statement that would make clear what is of more priority for the library, backward compatibility or new features. (As a matter of fact, I remember sometime back in 2013 when Radu was still active, he was against requiring C++11 in any foreseeable future.)

@SergioRAgostinho
Copy link
Member

We do not even have a "mission" statement that would make clear what is of more priority for the library, backward compatibility or new features.

Given the relatively lax constraints we have in terms of API changes, I would implicitly assume it's more focused towards new features.

Well it's gonna be a new PCL version so why not. Canonical already dropped support for 12.04 and we can provide a backport for 14.04 so...

I remember sometime back in 2013 when Radu was still active, he was against requiring C++11 in any foreseeable future.

So basically the c++11 adoption idea is to optionally provide support for it, but not require it. That's gonna be a whole lotta work 😅

@jspricke
Copy link
Member

jspricke commented Jul 9, 2017

I think the C++ standard needs a little more consideration then a library version.
For qhull, It's on 2015.2 for the mayor Linux distributions since one or two versions, so for me it's fine to update.

Regarding C++11, GCC6 changed to C++14 by default, so that should be fine with most of Linux. For Visual Studio I only found a blog post stating that they support a combined mode included C++11. For Apple, I was not able to find reliable information. Apart from that I don't see a big problem with allowing C++11 features.

@SergioRAgostinho
Copy link
Member

For Apple, I was not able to find reliable information

Based on these two:
Homebrew/legacy-homebrew#22453 (comment)
https://trac.macports.org/wiki/XcodeVersionInfo

OS X should not be a problem.

@jspricke
Copy link
Member

jspricke commented Jul 9, 2017

Fine with me, although they only talk about C++11 support, not if it's enabled by default ;).

@SergioRAgostinho
Copy link
Member

It's not. I didn't understand that was the the core argument 😅

@taketwo
Copy link
Member

taketwo commented Jul 9, 2017

So the consensus is that we review/merge this, effectively raising the QHull dependency version starting from 1.9?

@jspricke
Copy link
Member

jspricke commented Jul 9, 2017 via email

@SergioRAgostinho
Copy link
Member

Fine by me as well.

@SergioRAgostinho SergioRAgostinho mentioned this pull request Jul 17, 2017
3 tasks
@SergioRAgostinho
Copy link
Member

SergioRAgostinho commented Jan 26, 2018

Hey. Sorry for getting back to you so late. I started looking at this today but I'm facing weird problem in which github is not loading the diff of surface/include/pcl/surface/impl/concave_hull.hpp. Since it's a large one it doesn't load it by default as usual, but this time even when I click it's not loading at all.

myimage

Does anyone else have the same problem?

@taketwo
Copy link
Member

taketwo commented Jan 26, 2018

I have the same problem with FF, but with Chromium it works.

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.

Sorry for taking long to get back to you.

I never used QHull so my feedback is fairly limited.

I have two overall comment which need to be revised and addressed in multiple points:

  • The first one is regarding the use of int types for storing ids and indexes. By default you should use size_t, unless QHull/PCL actually places a requirement on using another type.
  • The second one is a request to avoid using the inner PointCloud::points directly. You have a pendent PR in our issue tracker which hides the access to this member, which I personally agree with. Therefore since the PointCloud container provides all resizing and indexing operations you need, I would ask to stick to using those.

else(QHULL_USE_STATIC)
set(QHULL_RELEASE_NAME qhull_p qhull${QHULL_MAJOR_VERSION} qhull)
set(QHULL_DEBUG_NAME qhull_pd qhull${QHULL_MAJOR_VERSION}_d qhull_d${QHULL_MAJOR_VERSION} qhull_d)
endif(QHULL_USE_STATIC)
Copy link
Member

Choose a reason for hiding this comment

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

Purrfect 👍

#include "libqhullcpp/QhullFacetList.h"
#include "libqhullcpp/QhullVertexSet.h"
#include "libqhullcpp/QhullRidge.h"
#include "libqhullcpp/QhullError.h"
Copy link
Member

Choose a reason for hiding this comment

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

Since you're already changing this part modify the includes to use < >. Qhull doesn't reside in our build tree.

{
polygons[dd].vertices.resize (3);
polygons[dd].vertices.resize (3);
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 slipped in unnoticed. It's breaking indentation with rest of the code.


hull_indices_.header = input_->header;
hull_indices_.indices.clear ();
hull_indices_.indices.reserve (num_vertices);

FORALLvertices
int i = 0;
Copy link
Member

Choose a reason for hiding this comment

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

This feels like it should be a size_t type.

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 should be a uint32_t because qhid_to_pcidx the gets used for filling up polygons[dd].vertices that is a vector of uint32_t


int num_vertices = qh num_vertices;
int num_facets = qhull.facetCount();
int num_vertices = qhull.vertexCount();
Copy link
Member

Choose a reason for hiding this comment

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

These feel like they should be a size_t type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same countT issue


if (dim_ > 2)
points[i * dim_ + 2] = static_cast<coordT> (cloud_transformed.points[i].z);
points.push_back(cloud_transformed.points[i].z);
}
Copy link
Member

Choose a reason for hiding this comment

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

Seems like you can preallocate points from the beginning.


qh_setvoronoi_all(qhull.qh());

int num_vertices = qhull.vertexCount();
Copy link
Member

Choose a reason for hiding this comment

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

size_t?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

qhull.vertexCount uses countT that is an int

alpha_shape.points.resize (num_vertices);

// Max vertex id
int max_vertex_id = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Is Vertex->id() returning int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, if you check the qhull headers they use countT and that countT is defined as an int.

@SergioRAgostinho SergioRAgostinho added needs: author reply Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Jan 28, 2018
@fran6co
Copy link
Contributor Author

fran6co commented Jan 28, 2018

@SergioRAgostinho About using PointCloud::points directly, I haven't made the change in this PR because I felt it would make the reviewing harder as it's not directly related to the current issue. I can make another PR after this one gets merged or add another commit to this one that fixes the PointCloud::points use in this files.

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.

I don't have anything else from my side then. :)

I think it's now a matter of deciding when to apply this given the ubuntu issue with qhull packaging.

@barcode
Copy link

barcode commented Aug 13, 2019

What is the status of this?
As far as i can see, the qhullcpp lib is missing for the most recent Ubuntu LTS (18) and this is stopping the PR from being merged. Is this correct, or are there different problems?

Would you be interested in an implementation with the qhull_r c-library?
It could be used as a solution of the non parallel issue until qhullcpp is available on the primary target systems.
I have a version using qhull_r and could create a PR. I also could change it to conditionally use the _r version if it is available.

@stale
Copy link

stale bot commented Feb 22, 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.

@stale stale bot added the status: stale label Feb 22, 2020
@kunaltyagi
Copy link
Member

kunaltyagi commented Jun 13, 2020

@PointCloudLibrary/maintainers What's the status on this? The diff appears to have been approved.

With 16.04 going EOL soon, and bionic distributing libqhull-r (link), we can effectively set a merge-by date for this PR

If we need the cpp lib, then it's available in groovy only

@stale stale bot removed the status: stale label Jun 13, 2020
@kunaltyagi kunaltyagi added the needs: feedback Specify why not closed/merged yet label Jun 13, 2020
@kunaltyagi
Copy link
Member

@larshg @mvieth Let's close this?

@mvieth
Copy link
Member

mvieth commented Jul 28, 2021

Let's close this?

Since the other pull request was merged, there is now support for multithreading via the re-entrant interface of QHull. Not the C++ interface, but I don't see a major advantage in using that. So yes, I am ok with closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConvexHull/QHull does not work with Multithreading
8 participants