I’ve noticed that when I have a generic buffer geometry, if I don’t set the type, the shape is indistinguishable. Is there a way to differentiate between triangles, rectangles, polygons, circles and arcs in this situation?
I can distinguish triangles, rectangles, and polygons, but I don’t know how to categorize circles and arcs.
Please share all sorts of mathematical knowledge and three.js tips.
Could you elaborate on how you’re creating the geometries and what you mean by categorization?
If you use built-in geometries, they always have a type assigned.
These are shapes created by directly assigning vertices to a Float32 array. It doesn’t specify that type.
This is a very complex task in the general case. If you know what types of shapes are possible – lines, squares, spheres, mushrooms, mickeymice, and so on – you may find a way to classify the shape. There are some algorithms for most shapes (e.g. Hough transform), but the most promissing results are given by well-trained neural networks. In any case, you might want to (re)search about Computer Vision algorithms for shape recognition.