Hi Shaun, On Do, 2014-03-20 at 01:00 -0400, Christopher Sean Morrison wrote:
> [snip] In fact, we just had a discussion on IRC earlier today that > pointed out another possibility. Instead of trying to wrap each > primitive and wdb interface individually, you could also propose > working on a generalized interface that would apply to all primitives. > For example, each primitive could publish a json-style parameter > dictionary for itself that callers would fill out by simply saying > "make me one of these". With that, the binding interface in python > would basically be to one function and would be future-proof as > primitives are changed or new ones are added. While I welcome the idea and it will make things easier, I must stress that the python code is more than just wrapping the WDB calls. For example a Pipe class instance: * is an iterator over it's control points; * you can set on it default d_inner/d_outer/r_bend parameters so you can just add points without repeating those over and over for a straight pipe (this is not live yet, but in progress); * you can manipulate the points as an array (append, delete, modify, insert at index, etc.); In general python makes (scripting) life easier. I would have never attempted to write the same in C, even if it is in fact possible. Same for combinations/regions, see an example here: https://github.com/ncsaba/python-brlcad/blob/master/examples/wdb_globe.py#L63 That's a very simple example but look at this one: https://github.com/ncsaba/python-brlcad/blob/master/tests/test_combination.py#L41 This is just a test case, in a real shape you would have names instead of the numbers, all the rest is the same. I wonder how it would look like with C ? I would never try to write analysis code or a primitive in python - that is C territory because of performance needs, but scripting geometry is not performance critical, languages like python are better suited there ! Cheers, Csaba ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ BRL-CAD Developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/brlcad-devel
