VisualAnalysisMode Draw-Methods vs UpdateVertexColors

Dear Everybode, and mostly @stevebaer
I would love to write a custom CurvatureAnalysis Version.

There is a nice example how to inherit VisualAnalysisMode:

But from the Rhinocommon-Documentation - for me it is not clear what is the Relation between UpdateVertexColors compared to all the virtual Draw… methods like DrawBrepObject or DrawNurbsSurface.

And are the Draw… Methods nested ? therefore will DrawBrepObject call DrawNurbsSurface for every Brep-Face ?

If i want to false-color a brep, the documentation tells me for false color i must override UpdateVertexColor - do i get the curvature-Information from the also passed RhinoObject ?
At the same color the documentation tells that DrawNurbsSurface is a good place to " display object-related meshes" - and i thought all surfaces in the document are Breps

A bit lost where to start.
Thanks for a starting-Point - after understanding the example mentioned above.
best regards
tom

Hi @Tom_P,

There is another sample you might want to review.

SampleCsZAnalysis.cs

Rhino object know how to draw themselves. When a Rhino object is assigned a visual analysis mode, it call the mode’s UpdateVertexColors override, when needed, to calculate false colors required to draw a mesh.

The additional VisualAnalysisMode.DrawXXXObjects methods are to assist with drawing instance definitions. Rhino’s internal surface curvture analysis display mode only overrides UpdateVertexColors.

– Dale

Dear Dale - thanks for your answer.
Where i am stuck is the parameters of UpdateVertexColors
UpdateVertexColors(Rhino.DocObjects.RhinoObject obj, Mesh[] meshes)
Both examples use the Mesh-Vertex-Z-Values to update the VertexColor - But for example if i want to query the curvature - the information for the color should come for the Brep-Object / its Nurbs Surfaces.
And this is what i am missing - as fare as i can see, the mesh-vertices do not have any information to wich part of the brep they belong - or i am wrong ?
… and i assume if i call BrepClosestPoint for each mesh Vertex i ll have a performance issue. But i will give it a try this way.
thanks.
Tom

Hi @Tom_P,

It appears there are a few things missing in RhinoCommon to make this easier. For one, the analysis meshes attached to Rhino surface and polysurfaces can contain surface curvature information (ON_Mesh::m_K). And this isn’t exposed in RhinoCommon. Having access to this would be a good start for you.

https://mcneel.myjetbrains.com/youtrack/issue/RH-51405

– Dale

Dear Dale - THANKs a lot