Hello everyone!

I implemented multiple face picking feature. I can get the indices then I am able to access positions of the faces from position buffer attribute. But what I want to achieve is putting a angle threshold value to differ faces acording to that angle. To be more clear, Assume the circle gets the faces between its ear and head. But If I had a threshold value less than 30 degree it should not have picked the face on ear.

I’ve come up with that example so far. I calculates the convex and concaves of the model. But I could not exactly get the math part of it. Do i need to have a dictionary which holds the adjacent vertexes of each vertex ?

Have you considered to just compare face normals? In this way, you can easily determine how adjacent faces are oriented in context of each other. The idea is to compute the dot product of two face normals and the use the arccosine to compute the angle (in radians). You can then compare this angle against a threshold.

2 Likes

Yeah that solution was the first idea that I come up with actually but models’s geometry is buffer geometry and I only have vertex normals not face normals and this method I guess works for while comparing two faces. Imagine I increased the area of the circle and selected 6 faces. What is the best approach to apply threshold u think ?

You can compute face normals like so:

```
// vA, vB and vC are the three vertices of a triangle
const cb = new THREE.Vector3(), ab = new THREE.Vector3();
cb.subVectors( vC, vB );
ab.subVectors( vA, vB );
cb.cross( ab ).normalize();
faceNormal.copy( cb );
```

Or you use Triangle.getNormal().

I think I would start by determine the closest face to your picker and use it’s face normal as a reference.

1 Like

There is a example here about finding the adjacent faces of a selected face. However it checks all the faces in order to find matching edges (by comparing two vertex). This solutions works on small datas however I have almost 80k face in my model. In my implementation I check for common vertexes and create a face map which holds the selected face as a key and its adjacents as a value. But its takes too much time in large datas. Imagine comparing 80k faces with another 80k faces to check whether they are adjacent or not ? How do u think do i enhence this algorithm ?