Does the command of Meshoutline exist a function to use by us ? (MFC/Rhino 5)


#1

I want to get a contour of mesh from a camera position and direction.
I found the meshoutline, but I can’t find a C++ function.
Does anyone know a similar function ? :grin:

this function:
http://docs.mcneel.com/rhino/5/help/en-us/commands/meshoutline.htm


(Menno Deij - van Rijswijk) #2

See rhinoSdkUtilities.h to find

/*
Description: 
  Creates polyline curve outlines from meshes.
Parameters:
  InMeshes   [in] - The meshes to outline.
  view       [in] - The view that provides the outline direction.
  tolerance  [in] - The tolerence used in the calculation (can be tiny).
  OutRegions [out] - The output curves
Return: 
  True if successful, false otherwise.
Remarks: 
  THE CALLER IS RESPONSIBLE FOR DESTROYING THE OUTPUT CURVE.
*/
RHINO_SDK_FUNCTION
bool RhinoGetMeshOutline(
        const ON_SimpleArray<const ON_Mesh*>& InMeshes,
        const CRhinoView* view,
        double tolerance,
        ON_ClassArray<ON_SimpleArray<ON_PolylineCurve*>>& OutRegions
        );

As you can see this is only usable with a view, not with a camera position and direction. It is, however, relatively easy to code this yourself:

  1. Project the mesh points onto the plane defined by the camera position (plane origin) and direction (plane normal).
  2. Transform the points from the plane to the XY-plane
  3. Use an enveloping algorithm to find the convex hull around the points.
  4. Transform the convex hull back to the projected plane.

#3

Thank you very much! :smiley:
I don’t know why I can’t find it through Rhino 5.0 C++ SDK Help.
The word “RhinoGetMeshOutline” can find out, but " MeshOutline" is nothing.
Let me confused. :weary:


(Menno Deij - van Rijswijk) #4

I always use Agent Ransack to search multiple files. It is free, and supports multiple file searching and regular expressions.


#5

Thanks, I am deeply moved. :blush: