IsPointOnFace(u,v) => IsPointOnSurface(u,v)?

Hi,

I’m struggling to determine if a uv point is on the visible part of a BrepFace or Surface.

When I work on a BrepFace it’s simple : I just call IsPointOnFace(u,v)

But I can’t figured out when I work on a trimmed surface that is not a Brep, for instant a sphere that is trimmed by a plane (see figure). Is there any thing like a IsPointOnSurface(u,v) for trimmed surfaces that are not Brep ?

I tried to get a Brep from my trimmed surface using srf.ToBrep() but the trim is lost in the process.

Help would be appreciate !
Thank you

trimmed surface.gh (12.4 KB)

Hello,

one solution: just do an additional “closestpoint” test and measure distance between this point and your point on surface. If its greater than tolerance, its obviously not on your visible surface.

PointOnSurface is the fundamental algorithm of Nurbs and works for any u and v, even outside of the domain. Its nothing more as a parametric equation.

Hope this helps

Hi Tom,

Ok, I’ll do that. But anyway, could you explain why when I plug my Srf parameter in my Brep parameter (on the GH Caneva) I get a correct conversion … while in the C# component the srf.ToBrep() will ignore the surface trim ?

Because Rhino.Geometry.Surface != GH_Surface

Rhino.Geometry.Surface doesn’t hold any trim data. Its a Brep property. Trimmed Surfaces are Breps with on face

Ok, does that mean GH_Srf is internally holding a single face Brep ?

1 Like

Hi @lionpeloux,

Technically, a GH_Surface wraps the functionality of a BrepFace. From the BrepFace you can get the owning Brep. So I think your description is accurate.

– Dale

Ok, I see …
How would you do to get the owning Brep of a BrepFace ? I can’t find any method in Rhinocommon to do that ?

Hi @lionpeloux,

There isn’t one. There probably should be one.

That said, when your in the context of dealing with brep faces you generally have the owning brep too.

Also, GH_Surface can return the owning brep.

– Dale

Hi Dale,

Yes, it is kind of strange as BrepEdge and BrepVertex have both a Brep property but not the BrepFace.
Would be great to add this for the future !

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

Great, thank you.