From: Daniel R. <dan...@gm...> - 2012-07-05 19:58:11
|
Oliver, 2012/7/4 Oliver Gloth <og...@en...>: > Hello, > > I am trying to write an interface to BRL-CAD for our open-source meshing > tool enGrid (see http://engits.eu/engrid). > > So far I have found the file "rtexample.c" which gives a decent starting > point to explore the ray-tracing functionality. What I could not find is > an example on how to explore a BRL-CAD database (i.e. get a list of > available objects, get bounding boxes of objects, etc.). This could be accomplished with db_walk_tree(). See http://brlcad.org/wiki/Example_db_walk_tree for an example. > In brief, this is what I would like to do: > > 1. open a .g file and offer the user a list of objects to select > 2. get the bounding box of all selected objects > 3. create a tetrahedral (or hexahedral) grid which covers the bounding box > 4. extract the surface of the geometry (either as iso-surface, or via > element subdivision, or ...) > 5. use the existing surface mesher and constrain the nodes to the > BRL-CAD model (via ray-tracing) > > Mainly what I need to access from BRL-CAD is: > > - information about the database > - shoot a ray and get the intersection point + surface normal vector at > the intersection > > I hope somebody could guide me in the right direction. > > Regards, > Oliver However, as the maintainer of BRL-CAD's core C++ interface I would recommend to have a look at it too. It should support all functionality you need: Ray-trace, bounding boxes, exploring the database, get a boundary representation of the objects etc.. See http://brlcad.org/wiki/BRL-CAD%27s_core_C%2B%2B_interface to get an idea on how it works. http://brlcad.org/wiki/CoreInterface_Tree_Walker_Example is an analogon for the above db_walk_tree() example. This interface is part of the brlcad.dll runtime library too. This DLL was intended for commercial applications using BRL-CAD. On Linux systems one can create a similar shared objects library. For LGPL compatible code the C++ interface sources can be used directly. Daniel |