Hide points - option

Any question about the main GUI application (frontend)
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Hide points - option

Postby vinayan » Tue Jan 24, 2017 11:35 am

hi Daniel,

I am trying to hide a few points in my cloud. The user would select point on the cloud using mouse and that point should be invisible now. I have checked the ccGenericPointCloud and graphicalsegmentationTool source. It seems I can only hide once using the existing methods. If i want to hide again, I need to call resetTheVisibilityArray() which will make the previously hidden points visible.

Below code hides a single point on a mouse click. But if i try to hide another point later, the previously hidden points become visible(obviously since I called the resetVisiblityArray). Are there options to keep on making points invisible? If nothing exist please suggest ideas where I can get it done by modifying the core.

In another words , getTheVisibilityArray() is always null unless i explicitly call resetVisibilityArray().

Code: Select all

void myPlugin::hideSelectedPoint(ccHObject* entity, unsigned itemIndex, int x, int y, const CCVector3& P)
{
   if (!entity)
   {
      return;
   }

   if (entity->isKindOf(CC_TYPES::POINT_CLOUD))
   {
      ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(entity);
      cloud->resetVisibilityArray();    // any alternatives other than resetting the whole visibility?

      ccGenericPointCloud::VisibilityTableType* visibilityArray = cloud->getTheVisibilityArray();

      visibilityArray->setValue(itemIndex, POINT_HIDDEN );      
   }

}

daniel
Site Admin
Posts: 3513
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Hide points - option

Postby daniel » Tue Jan 24, 2017 8:53 pm

You should first test if 'getTheVisibilityArray' returns a non null pointer. In this case this means the visibility array has already been allocated and you don't need to call 'resetVisibilityArray'. You can directly call visibilityArray->setValue.

You only need to call 'resetVisibilityArray' if the visibility array is not enabled yet.

Mind that to work properly, your plugin should restore the original state of the cloud at one point in time (with unallocateVisibilityArray).
Daniel, CloudCompare admin

vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Re: Hide points - option

Postby vinayan » Wed Jan 25, 2017 5:09 am

that worked!! although I am yet to understand what will happen if i do not set unallocateVisibilityArray. Hopefully a scenario would popup as I use the plugin and help me solve the problem. Thank you.

daniel
Site Admin
Posts: 3513
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Hide points - option

Postby daniel » Wed Jan 25, 2017 6:24 am

In this vase the points will remain invisible which may be confusing for the user. Invisible points are not deleted. Once done you should create a new cloud for instance (with the visible subset - there's a dedicated method to do this) and restore the original cloud visibility for instance.

But it all depend on what you are trying to achieve of course ;)
Daniel, CloudCompare admin


Return to “CloudCompare”

Who is online

Users browsing this forum: No registered users and 2 guests