Home › Forum › SOFA › Programming with SOFA › [SOLVED] Proper way of removing points in a Topological Mapping
Tagged: 64_bits, MacOS, SOFA_1512, subdivision, Topological mapping
- This topic has 4 replies, 3 voices, and was last updated 8 years, 3 months ago by manny.
-
AuthorPosts
-
9 September 2016 at 22:51 #7450mannyBlocked
I have a subclass of TopologicalMapping and I am trying to remove points in updateTopologicalMappingTopDown(). However when I call removePointsProcess on the TopologyModifier (or any function that remove points, such ass removeQuad with the removeIsolatedPoints argument set to true) the NbPoints goes down but the next time I add a point the number goes back up as if no points had been removed.
For example:
nbPoints:26
remove 1 point
nbPoints:25
add 1 point
nbPoints:27How can I force these points to be removed?
12 September 2016 at 11:14 #7455epernodBlockedHi,
maybe it is a bug from the topolicalMapping. Did you encounter that problem with a single topology?
Can you see if the removed point, comes back exactly as it was or is it null?
What process do you use to add the new point?
Erik
13 September 2016 at 18:17 #7464mannyBlockedThe removed point comes back exactly as it was.
I am doing this in a topological mapping which requires both an input topology and an output topology.
This is the process I use:
QuadSetTopologyModifier *to_tstm; toModel->getContext()->get(to_tstm); to_tstm->removePointsWarning(*tab_indices, false); to_tstm->propagateTopologicalChanges(); to_tstm->removePointsProcess(*tab_indices, false); to_tstm->propagateTopologicalChanges();
I do get a message in the console saying: ‘points is dirty’ when I remove the points for what it’s worth.
19 September 2016 at 10:57 #7487jnbrunetModeratorHi Manny,
I may be wrong, but after a quick look inside topology modifiers and containers, it looks like a PointSetTopologyContainer will never change its array of points. It is the upper level containers (for example, the QuadSetTopologyContainers) that will reorganize its topology by removing the indexes pointing to a removed point.
In that case, a removed point still exists in the PointSetTopologyContainer, but no structure should (in theory) be pointing to its memory space.
You should then always avoid looping over the PointSetTopologyContainer by using, for example, i = 0 to getNbPoints() and getPX(i).
You could in contrast looping over the Quads in the QuadSetTopologyContainer. Since a Quad is simply an array of 4 PointIDs and since those PointIDs are (in theory) pointing to a valid memory location in the PointSetTopologyContainer, you could gather all the valid points of your topology this way.
I hope that helps.
Jean-Nicolas21 September 2016 at 17:35 #7497mannyBlockedI see, thank you for the help.
-
AuthorPosts
- You must be logged in to reply to this topic.