This may be a question only @DavidRutten can answer - but in the Grasshopper API, the description of the Boundingbox property of IGH_GeometricGoo states:
Gets the (cached) boundingbox for this geometry. Not all geometry types cache boundingbox results.
I am particularly interested in this bounding box caching and how it works. What types of geometry have the bounding box cached and when does the bounding box calculation happen? I have a few components that have their own bounding box caching code that this could potentially eliminate if I understand how it works, and in the best case scenario, the bounding boxes have already been calculated cutting out some of my computational overhead.
Also - it wasn’t clear if it was a loose bounding box or tight bounding box, though I suppose that could be easily tested.
Bounding boxes are almost always calculated because a shape preview needs to be drawn. Before you can include geometry in a drawing operation, that operation must have big enough clipping bounds to include that shape.
Since it is expensive for some types of shape to compute bounding boxes, I reserved the right to cache some of them. This can potentially lead to problems if code modifies the state of the Value inside the Goo, but doesn’t assign a new Value. This is programmatically possible, although should never happen as all Goo instances are presumed to be shared amongst multiple parameters and therefore ought never change once constructed.
I believe it is the tight boundingbox I cache, but I’ll have to check that onceI get into the office. If you’re caching a value, may as well cache a high quality value…
Ok, Interesting, so am I correctly interpreting that typically the bounding box is only calculated when the object needs to be drawn to the screen?
In my case the geometry usually isn’t getting drawn before I need the bounding box, so when I call IGH_GeometricGoo.Boundingbox the first time I presume it will usually be calculating a new bounding box. Then the question is if I call it a second time from within the same component or even downstream in another component, will it be accessing a cached version from the first call or calculating a new box?
I’m definitely fine with not modifying the state of the Value in the Goo in my use case. I’ve witnessed enough of the unexpected consequences to realize it is usually a bad idea.