specklesystems / speckle-sharp

.NET SDK, Schema and Connectors: Revit, Rhino, Grasshopper, Dynamo, ETABS, AutoCAD, Civil3D & more.
https://speckle.systems
Apache License 2.0
365 stars 168 forks source link

Objects: Support for n-gons #780

Closed izzylys closed 2 years ago

izzylys commented 2 years ago

Support n-gons or triangulation of them in mesh conversions on receive using the n as the first item in the polygon index array.

Once we have more complete support across connectors, we can consider using 3/4 indicators for outgoing faces in ToSpeckle conversion. Currently, we are still using 0 and 1 for backwards/cross compatibility.

Support for 3/4 faces

Support n-gon ToNative conversion

Documentation

JR-Morgan commented 2 years ago

The Viewer, Unity, and AutoCad don't support N-gons/face triangulation natively, and so we would have to triangulate them during ToNative conversion.

I propose creating a triangulation function to be added to the Objects namespace. Then the AutoCad and Unity connectors can both use this function. This function (or a similar one) can be created in JS to be used by the viewer.

Ideally, this function should be able to deal with concave and non-planar faces.