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

How to remove single vpMbtDistanceLine from tracking #1218

Open
constiDisch opened this issue Aug 25, 2023 · 4 comments
Open

How to remove single vpMbtDistanceLine from tracking #1218

constiDisch opened this issue Aug 25, 2023 · 4 comments

Comments

@constiDisch
Copy link

Hi,
i am quite new to visp and have the following question:
I have a relatively complex cad model, which I wanted to load and track with the vpMbGenericTracker in particular the moving edge approach.
However, I want more or less all faces in a visibility check, but be able to remove single lines individually based on other criteria (e.g. to use only lines which have faces with a large angle, or to focus on some very specific part if the model if visible, ...).

So my idea was to loop through the vpMbtDistanceLine and remove them from tracking (without removing the entire face from tracking, because this could have some side-effects to other lines).

Is there a way to achieve this?
I found vpMbtDistanceLine.setTracked --> but it has some checks with the connected polygons.
Thanks a lot for you hints.

@constiDisch constiDisch changed the title vpMbtDistanceLine remove from tracking How to remove single vpMbtDistanceLine from tracking Aug 25, 2023
@fspindle
Copy link
Contributor

I suggest that you have a look to How to set a name to a face and How not to consider specific polygons.

@constiDisch
Copy link
Author

Thanks for your hints. Perhaps I am missing something here, but I do not want to set an entire polygon as not tracked, but only a single line of polygon.
Thus I was looking at the code in vpMbtDistanceLine::setTracked, but it seems to check whether all corresponding polygons are not tracked and then turn off the tracking.
So is there a possibility to set tracked/not for an single edge?
I think of something like an forceTrack (or similar)?

@fspindle
Copy link
Contributor

The feature you are looking for is not implemented. I confirm that vpMbtDistanceLine::setTracked() consider all the edges of a single polygon. Introducing a way to enable/disable tracking of a single edge belonging to a polygon is possible, but will need to enter deeply in the code.

I didn't check enough, but it seems possible to modify vpMbtPolygon to add a function disableEdge(int index) that will disable a specific edge from tracking by setting for example a bool to true to the 2 vpPoints associated to the edge with index. For that, you should introduce a new private class member std::vector<bool> m_edgeDisabling that will have the same size as the vpPoint *p array. By default each element of the m_edgeDisabling is set to false.

// First edge has index 0
void vpMbtPolygon::setEdgeName(int index, const std::string &name)
{
  if (m_edgeDisabling != getNbPoint()) {
    m_edgeDisabling.resize(getNbPoint());
    for (size_t i = 0; i > m_edgeDisabling.size(); i++) {
      m_edgeDisabling[i] = false;
    }
  }
  m_edgeDisabling[i] = true;
  m_edgeDisabling[i + 1] = true;
}

Then, in vpMbtDistanceLine::initMovingEdge() you can use the bool to add or not the edge to the vector of meline.

Hope it helps

@constiDisch
Copy link
Author

Thanks for your help and suggestions. I will have a try!

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

No branches or pull requests

2 participants