0

Is there a way to recognize if a node in the model has holes?

For example, we want to know if there's a window in a wall or some other opening, and how many such openings and their location.

I tried to iterate over the polygons of the node, taking their centroid and normal and trying to find a discontinuity, but it doesn't give a high confidence result.

Also tried to count straight lines other than the ones at the edges but sometimes a straight line appears in the middle of a wall.

So is there another way to do this? Maybe there's a built-in function in Three.js to count edges of a mesh?

shinzou
  • 5,850
  • 10
  • 60
  • 124
  • you should check this article [Here](https://aboosbox.wordpress.com/2017/04/17/three-js-for-absolute-beginners/) – Aboobakkar P S Apr 25 '17 at 08:56
  • @Aboopallikara how is this relevant? – shinzou Apr 25 '17 at 08:59
  • Did you consider [EWS](http://www.devdept.com/eyeshot/webservice)? You could convert the model to XML and access all BRep data, like outer and inners face loops. – abenci Apr 26 '17 at 06:11
  • This will convert the whole model but I want to detect edges on a small part of the model... Also it looks like it has to be done with some server? I want it to work offline in the browser on demand. – shinzou Apr 26 '17 at 08:36

1 Answers1

1

There are probably very easy ways to count edges and so on, but I am afraid they will not help much unless you have extremely simple geometry, and no exceptional cases.

For a more general solution, I think your best bet will be to generate a solid model from your polygons using their vertices, edges, normals, etc., and some 3D geometry library that is capable of working with solids to analyse their topology.

Here is the first one that came up when searching for "js 3d boolean"

https://duckduckgo.com/?q=js+3d+boolean

FinalMesh Boolean 3D Library:

http://finalmesh.com/boolean3d.htm

This one says that it can process polygons with holes and optimise them, including removing holes, removing extra points and generating polygons from triangles.

Given a polygon P, you could remove its holes to generate a hole-less polygon Q, then subtract P from Q to obtain all the openings in P.

I am sure there are many others available out there for you to evaluate and compare as well.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • Thanks, good idea, but I don't see that Finalmesh has a js library, just an offline software, and c++ library. Is there another library that you recommend? – shinzou Apr 25 '17 at 17:32
  • oh sorry, i didn't notice. try searching yourself. this search string might work better: ["javascript library boolean operations 3d"](https://duckduckgo.com/?q=javascript+library+boolean+operations+3d). for instance, it finds [csg.js](https://evanw.github.io/csg.js/). – Jeremy Tammik Apr 26 '17 at 18:14
  • also check these other stackoverflow threads: - [three.js bind two shapes together as one](https://stackoverflow.com/questions/8322759/three-js-bind-two-shapes-together-as-one) - [how to do dynamic csg operation with three.js](https://stackoverflow.com/questions/22138151/how-to-do-dynamic-csg-operation-with-three-js). – Jeremy Tammik Apr 26 '17 at 18:28