mcneel / rhinocommon

RhinoCommon is the .NET SDK for Rhino5 / Grasshopper
http://wiki.mcneel.com/developer/rhinocommon
242 stars 93 forks source link

MeshPolyline #86

Closed MoeGreen closed 6 years ago

MoeGreen commented 12 years ago

In Rhino we can find a good command to create a mesh from polyline 2D and 3D. Could you export it to RhinoCommon?

Thanks, Moe.

sbaer commented 11 years ago

Dale, is this already exported in the C++ SDK?

dalelear commented 11 years ago

Steve,

The ON_Mesh2dPolygon() and ON_Mesh2dRegion() functions in the C++ opennurbs SDK are the computational tools you need.

The request for a 3d version will requires a 3d plane to go with the 3d curve and the 3d curve must project to the plane in a reasonable manner. If the 3d curve is planar, then use the 3d plane that contains the curve. Once you have a 3d plane, use the change of basis transformation (note well - do not use the planar projection transformation) to convert the problem to a 2d computation and then map that solution back to 3d. If the polyline is not closed, you will have to supply some sort of closed boundary that contains the polyline.

The C++ function

ON_Mesh2dRegion( unsigned int point_count, unsigned int point_stride, const double* point, unsigned int edge_count, unsigned int edge_stride, const unsigned int* edge, unsigned int edge_side_stride, const unsigned char* edge_side, ON_SimpleArray& triangles, ON_SimpleArray& new_points )

accepts interior constraints as well.

dalefugier commented 6 years ago

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Polyline_TriangulateClosedPolyline.htm