Hi Alex,
There are a few options that come to mind:
a) If it's not performance intensive metadata, you can associate
arbitrary data to any object as an attribute or set of attributes.
Attributes are key=value string data. You could utilize that to
store per-vertex metadata using either keys that tie to vertices or a
single key that ties to a value set for all your vertices.
b) You could maintain a parallel storage of arbitrary binary data
using binary objects. I'd probably set an attribute (e.g.,
color_values="my_table") on your NMG object that refers to a binary
object. The binary object ("my_table" in this example) would then
contain whatever data you want.
c) We could extend any one of the NMG structures (e.g. struct vertex)
to have a user data pointer. Simple enough, though if this route is
selected, it'll probably be worthwhile to add a user data pointer to
*all* of the core NMG structures (vertex, edge, loop, face, shell,
nmgregion, and model) or their respective use structures for
consistency.
d) You can utilize the nmg_visit_handlers interface to maintain an
arbitrary data structure with your data when it actually comes time
to process the data. This is probably the most effective for in-
memory processing, but of course is not that effective as a means of
serialization (though coupled with (b) it could be).
If (c) is most appealing, we can discuss in further detail on the
brlcad-devel list to make sure any change we make fits your needs.
There are possibly a few other options as well, but that's just what
immediately came to mind.
Cheers!
Sean
On Apr 27, 2009, at 8:28 AM, Nu Eu wrote:
> Hi,
> I would like to be able to store custom data for some vertices from
> BRL-CAD object and don't see any means to do it after reading the
> introduction.
>
> The next thing I thought of is adding some structure to the base
> vertex type. But point_t is a vector of floats, so it would be quite
> complicated.
>
> What else could I use to store custom data?
>
> Thank you for attention,
> Alex
>
> ----------------------------------------------------------------------
> --------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensign option that enables unlimited
> royalty-free distribution of the report engine for externally
> facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> BRL-CAD Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/brlcad-users
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
BRL-CAD Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-users