# selecting acute points by angle threshold

## Recommended Posts

Hello good people of the interwebs!

I have a VEX (beginner) question. I want to group points of a poligonal mesh based on their acuteness (i.e. how "pointy" they are). Very similar to what the group node allows to do with edges, where one can simply define the minimal edge angle of the two adjacent primitives to decide if an edge is included in the group.

I need a similar thing, but with points and a point group and taking into consideration the angles between the three (or more) adjacent edges.

(I imagine a loop and the neighbor and neighbor count functions and some angle comparison wizardry but I can't figure out how to tie all that together in any meaningful way Houdini can understand.) Your help is very much appreciated.

Beautiful holidays to you and sweet learning by your handsome examples to me!

Felix

Edited by grafikzeug

##### Share on other sites

Does it have to be a VEX solution? Because you can measure the curvature of each point using the measure SOP and come to the same conclusion.

In the measure node: set the element type to points, and measure to curvature. Then you can isolate the pointy points with a point wrangle and setting a threshold value:

```if(@curvature > 2.5){
i@pointy = 1;
}```

##### Share on other sites

Hi Felix,

first you would iterate over all neighbours() with foreach(), adding all dot products of the point's and the neighbors' normals. Then you divide this sum by the number of its neighbors.

```// INPUT
float thresh = chf('threshold');

// PROCESS
float d = 0.0;
int nbs[] = neighbours(0, i@ptnum);
foreach(int nb; nbs){
vector nml_nb = point(0, 'N', nb);
d += dot(v@N, nml_nb);
}
d /= len(nbs);

// OUTPUT
f@acuteness = d;
i@group_acute = thresh > d;
v@Cd = hsvtorgb(set(1.0 - d,1,1));```

There is a a bit on curvature and the likes in the documentation about the new measure SOP: https://www.sidefx.com/docs/houdini/nodes/sop/measure.html

Edited by konstantin magnus

##### Share on other sites

Hey Mark and Konstantin,

your responses are very valuable to me. The measure SOP approach is useful because it's so straightforward (and showing me that there are many thins readily available) and the VEX solution is a perfect learning opportunity for me. Great!

Thanks for the time you put into helping me!

## Create an account

Register a new account