0

In our Forge app we need to select all elements that are adjacent to a given element. Example: User selects a floor element and this causes adjacent foundations, walls etc. to be selected. When I say adjacent I mean intersecting elements and elements where the surfaces touch each other.

We tried to achieve this by comparing the bounding box of all elements with each other, but it only works for simple geometries (cubes) where the size of the bounding box is almost identical to the size of the element itself, and where the element edges are oriented along (x,y,z). (Not rotated). The attached image illustrates how the bounding box (in red) of a complex floor works poorly, because it will cause selection of foundations and columns (in green) that are clearly separate from the floor.

So what I am asking is either:

  • Is there a built-in function for getting adjacent elements? If not;
  • How do I get the points that define the outline of an element? I am not interested in the rendered WebGL triangles, just the original points (E.g. 8 points for a cube).

Regards, Torjus

torjuss
  • 11
  • 4

1 Answers1

0

This is a very specific request, there is no built-in function for such a complex computation unfortunately. Depending on the geometry you are dealing with it could be a very costly operation and you would need to implement that custom logic yourself.

The final algorithm would probably require several steps, the first being a quick bounding box check as you mentioned, followed by finer analysis. You can take a look at that article to see how to retrieve vertices of a given element: Accessing mesh information with the Forge Viewer

Felipe
  • 4,325
  • 1
  • 14
  • 19
  • Thank you, Phillipe! I understand that it is a specific request, and yes, a costly operation too. We don't require 100 % accuracy, but better than just the bounding box. As long as we can get the vertices we can get a better solution. Thank you for the link. – torjuss May 29 '18 at 07:10