Re: [brlcad-devel] Can we get the solids within a tree without extra info?
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Christopher S. M. <br...@ma...> - 2013-09-04 04:32:04
|
On Sep 3, 2013, at 11:48 PM, Clifford Yapp wrote: > On Tue, Sep 3, 2013 at 5:48 AM, phoenix <284...@qq...> wrote: >> Hi! >> >> I'm implementing rt_comb_brep() which is going to convert a COMB to BREP >> with NURBS boolean evaluations. But currently I have to pass in a db_i >> pointer every time because the tree only stores names in its leaves, so we >> have to look up the database and find the solids referred to in the COMB. Not great, but not the end of the world. Reason it's not const? Reason it's not named "dbip" instead of "db"? >> But other rt_XX_brep() functions doesn't have that pointer, so they are not >> consistent. My question is, is that any way that we can eliminate that param >> (for consistency and elegance) and find the solids referred to provided only >> a tree (union tree)? But this is exactly why comb lives in a separate comb subfolder and not the primitives folder with most of the other object types. It's different and must be handled differently. That said, it certainly is worth exploring what might be needed to make them the same. This is in part why db_tree_state and db_full_path exist, might be something there that could be used/extended. > The only way I can see is to add a slot for the db_i pointer to either > rt_comb_internal or rt_db_internal and make sure it is initialized > before any of the rt_XX_brep calls, but that feels clumsy even if > altering one of those structures can be done without introducing other > problems... hmm. Both of those structures do not have a dbip as they don't belong to any particular dbi and conceivably could belong to many simultaneously. This is intentional design. > Sean, is there a standard way to get at db_i information while walking a tree? You need a dbip to walk a tree or a union tree that has been filled in (which is what Wu has now). The union tree either has or could have the information needed. It obviously would be ideal to not pass the dbip, but that means the union tree (or something similar) will need to have the necessary. Cheers! Sean |