How to delete duplicate data?

   648   5   1
User Avatar
Member
1 posts
Joined: 7月 2024
Offline
Hi all,
I'm new to Houdini. I'm wondering how to delete duplicate data?
My final aim is to get 0.16, 0.33, 0.66 only.

Attachments:
螢幕擷取畫面 2024-09-07 193300.png (8.2 KB)

User Avatar
Member
2625 posts
Joined: 6月 2008
Offline
Data is associated with the context where you created it. I'll assume you added those values to the point context. To remove the additional data, just delete points.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
143 posts
Joined: 6月 2024
Offline
Enivob
Data is associated with the context where you created it. I'll assume you added those values to the point context. To remove the additional data, just delete points.

I think the author meant an algorithm for removing duplicates and leaving only points with unique values. As far as I remember, there are no such ready-made functions for removing duplicates in Vex? Only through the for loop you need to make an algorithm, as it seems to me.
User Avatar
Member
297 posts
Joined: 1月 2013
Offline
You could just mark duplicates found and then delete those points or follow some other logic to exclude them from processing. And of course you need to sort the points by the area attribute.

Run Over: Detail(only once)
float first = point(0, "area", 0);
for(int i = 1; i < npoints(0); ++i){
    float value = point(0, "area", i);
    if(abs(first - value) <= 1e-5){
        setpointattrib(0, "del", i, 1);
    }else{
        first = value;
    }
}
Edited by alexwheezy - 2024年9月10日 12:42:08

Attachments:
2024-09-10_19-37.png (6.4 KB)

User Avatar
Member
185 posts
Joined: 2月 2016
Offline
Or use the fuse node in match attribute mode and disable the `snap distance` & `output position`. That would only keep one of each value

Attachments:
firefox_vNUsagEz6h.gif (513.6 KB)

User Avatar
Member
143 posts
Joined: 6月 2024
Offline
AslakKS
Or use the fuse node in match attribute mode and disable the `snap distance` & `output position`. That would only keep one of each value

Image Not Found
You are a genius! We completely forgot about this wonderful function in fuse!
But I will note, if the points are connected, then you need to disable "remove point from degenerate prim" otherwise the remaining points will disappear and you will not understand what happened.
  • Quick Links