Evaluate SubD?

Hi all!

With meshes we have .PointAt() and .NormalAt() methods.
What about SubDs?
Can we extract, say, a point in a face giving it the face index and the vertexes coordinate?

And the opposite.
Intersecting a ray to a SubD, can’t we get a “SubD parameter”?

I’m more interested on the first part tought.
Any workaround much appreciated…

maybe evaluate as brep?

That’s… not “evaluating”.
I need to work by code, starting from vertexes and following some logic extracting points and normals around each vertex, but by followin the face-edge topology (like in meshes).

Also the brep structure is way heavier.
I hope that extracting point+normal of a subd is faster.

hmm, yes I see
if you treat the subd as mesh it will take the control mesh and gives weird results.
you might take the approximated (render)mesh then, not sure if that helps in your case?

This post is not about grasshopper.
I mean, i will use it inside grasshopper… :rofl: … but the question is about managing SubDs in rhinocommon/c# .

Yes, using the rendermesh would be good, because the mesh vertexes lie on the subd surface and normals are decent, but i would still need some relationship between the SubD topology and the rendermesh topology.
And also, GH have that “Mesh from SubD”, but rhinocommon not.

I would ask Dale Lear … but i remember he retired…

yes I know it’s not about gh, but as far as I know if it is in gh, it should also be in rhinocommon. I think the mesh from subd is this one:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Mesh_CreateFromSubD.htm

1 Like

The order of vertices seems to be not staying the same though :grimacing:

subd-mesh.gh (9.8 KB)

I am sure @Jussi_Aaltonen and @pierrec can help with that.

1 Like

Actually you were right, that can be a workaround:


(i’m using a clipping plane…)
Faces seems to keep an usable order.

I’ll dig things up a bit and let you know.

@maje90 Yes, the render mesh faces are ordered in a manner that makes it quite easy to find the correlation between SubD faces and the mesh faces. Let me know if you need help.