xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
255 stars 128 forks source link

Question regarding geometry #107

Closed twoelfer closed 6 years ago

twoelfer commented 6 years ago

hi.

I can read all the XbimShapeInstances für the IIfcProducts that i want and i can also get the XbimShapeTriangulation usgin ReadShapeTringulation().

Basically, this gives me all the meshes i need for use in visualization. However, i do actually need something else. Given that the meshes appear to be calculated by xbim, i assume there is also information regarding the edges of the products. (That's what i'm actually looking for.)

Is there an easy (any ?) way to get these edges?

lucasaue commented 6 years ago

Well, easy way I don't know, but you can calculate this edges.

When you say edges, I think in that you wanna the Outline, that's all external edges from mesh.

If is just for visualization, like a selection, or Wireframe visualization, I recomend you to use a shader, because the calculation is more simple and fast. In unity you have this example:

https://answers.unity.com/questions/1226994/outline-rendering.html

But, if you need the polys with points, you can use this algorithm:

Boundary edges are only referenced by a single triangle in the mesh, so to find them you need to scan through all triangles in the mesh and take the edges with a single reference count. You can do this efficiently (in O(N)) by making use of a hash table.

To convert the edge set to an ordered polygon loop you can use a traversal method:

The traversal will give a polygon loop that could have either clock-wise or counter-clock-wise ordering. A consistent ordering can be established by considering the signed area of the polygon. If the traversal results in the wrong orientation you simply need to reverse the order of the polygon loop vertices.

If you wanna more information, I recomend you take a look in this post:

https://stackoverflow.com/questions/14108553/get-border-edges-of-mesh-in-winding-order

twoelfer commented 6 years ago

Thank you, this helps, and i can use this to get to the polygon points I need. However, given that "something" is creating those meshes based on some data in the file, i would have thought there was a method to get to the "original" data that was used to create the meshes in the first place - instead of un-triangulating the meshes. :-)

Anyhow, works.

martin1cerny commented 6 years ago

Can I close this issue now?

twoelfer commented 6 years ago

Yes please. (Should i have done something ? I don’t really know how github works…)

Von: Martin Černý notifications@github.com Gesendet: Donnerstag, 24. Mai 2018 10:54 An: xBimTeam/XbimGeometry XbimGeometry@noreply.github.com Cc: twoelfer tw@die.de; Author author@noreply.github.com Betreff: Re: [xBimTeam/XbimGeometry] Question regarding geometry (#107)

Can I close this issue now? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xBimTeam/XbimGeometry/issues/107#issuecomment-391640056 , or mute the thread https://github.com/notifications/unsubscribe-auth/AlLWttwCcIkRm-5-tso5wdj4s5qcF5jXks5t1nUNgaJpZM4TytYO .

martin1cerny commented 6 years ago

You could press Close button bellow the conversation thread :-)

twoelfer commented 6 years ago

Ok, thank you, i’ll remember to do this next time…

Von: Martin Černý notifications@github.com Gesendet: Donnerstag, 24. Mai 2018 12:19 An: xBimTeam/XbimGeometry XbimGeometry@noreply.github.com Cc: twoelfer tw@die.de; Author author@noreply.github.com Betreff: Re: [xBimTeam/XbimGeometry] Question regarding geometry (#107)

You could press Close button bellow the conversation thread :-) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xBimTeam/XbimGeometry/issues/107#issuecomment-391663972 , or mute the thread https://github.com/notifications/unsubscribe-auth/AlLWtn7EcUidCVPk18sgD1WyERfirtkXks5t1okHgaJpZM4TytYO .