How to shrink uv bounds to outer wire?

Hello,

I sometimes encounter faces that have significantly larger uv bounds than their outer wire encompasses, and I would rather not have this. Feels a bit unnecessary and messy.

I am wondering if there is any reasonably convenient OpenCascade function to shrink a face's uv bounds to be closer to the outer wire? It's possible to do manually, I am sure, but maybe there is already functionality for this available?

Thank you :)

Mikhail Sazonov's picture

UV bounds are not stored in the face. They are computed on the fly by the method BRepTools::UVBounds.

If they are wider than outer wire then probably it is the algorithm of computing of 2D bounding box of a curve 2D does so due to B-spline form of the curve. For a B-spline curve probably the poles of bspline are used to compute the bounding box. 

Though there is the method to compute the optimal bounding box it is not used inside UVBounds due to the optimal algorithm is very time consuming.

Nathaniel Essenberg's picture

Thank you for your insights, this is helpful to know!

"UV bounds are not stored in the face. They are computed on the fly by the method BRepTools::UVBounds"

This makes complete sense. It's interesting, because I am pretty sure I *should* have a simple rectangular outer wire. I will dive into my code and maybe the debugger later today or this weekend.

It might be possible that the 2D curves on surface are not (yet) defined, or are not following the surface anymore from changes earlier in my code. So I wonder if BRepTools::UVBounds() fixes the 2D curves when they are wrong or missing. Otherwise, maybe this causes the problem?

I will probably end up adding some shape healing for safety anyway, so the problem might "go away" :D