Editing Geometry Viewer Application for BRL-CAD
From BRL-CAD
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 10: | Line 10: | ||
== Outline == | == Outline == | ||
− | The idea is to build a geometry viewer application that generates a standalone double-clickable file that views a given model. The approach is to concatenate the contents of a given “.g” file with the function calls from librt and display a “.g” file, in a standard brlcad setup. | + | The idea is to build a geometry viewer application that generates a standalone double-clickable file that views a given model. The approach is to concatenate the contents of a given “.g” file with the function calls from librt, libdm that parse and display a “.g” file, in a standard brlcad setup. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Our motivation is to introduce portability and ability to share results of brlcad via email with users who don’t have brlcad setup in their environments. First we will develop a standalone application but later this can be integrated into mged or any other tool as a brlcad feature. | Our motivation is to introduce portability and ability to share results of brlcad via email with users who don’t have brlcad setup in their environments. First we will develop a standalone application but later this can be integrated into mged or any other tool as a brlcad feature. | ||
− | |||
− | |||
== Task Breakdown == | == Task Breakdown == | ||
Line 37: | Line 26: | ||
• [http://brlcad.org/docs/doxygen-r64112/d4/de4/group__libdm.xhtml '''Libdm'''] is BRL-CAD's primary graphics display manager (dm) library. It is used to display geometry in GUI. This will be utilized by our source to visualize model files. | • [http://brlcad.org/docs/doxygen-r64112/d4/de4/group__libdm.xhtml '''Libdm'''] is BRL-CAD's primary graphics display manager (dm) library. It is used to display geometry in GUI. This will be utilized by our source to visualize model files. | ||
− | This resulting draw result will then be bundled into an | + | This resulting draw result will then be bundled into an “.exe” (windows) and later into packages for Mac & Linux. |
== Task list == | == Task list == | ||
; 1. Evaluate technology to be used | ; 1. Evaluate technology to be used | ||
− | * | + | * Develop initial project design draft |
− | * | + | * Setup development environment |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
* Evaluate programming language choice (C decided, for GUI may use some Python) | * Evaluate programming language choice (C decided, for GUI may use some Python) | ||
; 2. Evaluate and look into current viewer applications: | ; 2. Evaluate and look into current viewer applications: | ||
Line 85: | Line 38: | ||
* Isst, it doesn’t use libdm. | * Isst, it doesn’t use libdm. | ||
* Geometry viewer [https://github.com/BRL-CAD/geometry_viewer] | * Geometry viewer [https://github.com/BRL-CAD/geometry_viewer] | ||
− | ; 3. Create | + | ; 3. Create application interface to brlcad libraries [http://brlcad.org/w/images/3/3d/Application_Development.pdf] |
+ | * Interface with librt | ||
+ | Librt is used to open brlcad geometry files and edit them. It reads a .g file by calling the function [http://brlcad.org/docs/doxygen-r64112/d3/d9b/group__dbio.xhtml#gaa9eb8edb99fa1da5d188587e07d8dacc '''db_open'''] and populates a [http://brlcad.org/docs/doxygen-r64112/d2/d66/structdb__i.xhtml '''db_i structure''' ]. To view the geometry files we need [http://brlcad.org/docs/doxygen-r64112/d4/de4/group__libdm.xhtml '''Libdm'''] which takes this db_i structure as input to do so. | ||
+ | |||
+ | This [https://github.com/asadpiz/brlcad-viewer/commit/1fb3cda80b35b2e1ee84332fd1039ced4c2e9865 '''commit'''] takes a .g file and calls the db_open function from within the viewer application. Right now it just prints out a single value from the populated structure. | ||
− | + | An [http://brlcad.org/wiki/Example_db_walk_tree '''example'''] is already available that shows the usage of db_open. We are utilizing the skeleton of this example to populate the struct db_i. | |
− | + | * Interface with libdm | |
+ | ; 4. Create application interface with model file: | ||
+ | * Create input interface to parse “.g” file | ||
+ | We need to read the binary ".g" file and concatenate it with our program. The first step is to identify the .g files from their file header. Using the hexdump command it is confirmed that all " .g" files have first 40 bytes common. | ||
<source lang="bash"> | <source lang="bash"> | ||
hexdump -C build/share/db/wave.g | head | hexdump -C build/share/db/wave.g | head | ||
Line 103: | Line 63: | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | The [https://github.com/asadpiz/brlcad-viewer/commit/f064ad3bdb37bbfd0d9f982c73891bbe47724d8d '''commit'''], simply reads a file into a buffer and prints out its contents. Our interest is in the header bits of the file i.e., the bits that start with 7601...., these will help us identify the start of a ".g" file later. | |
− | ; | + | * Create output interface to parse output from libdm. |
+ | ; 5. Develop front end | ||
* Develop Single window view | * Develop Single window view | ||
* Develop File Input | * Develop File Input | ||
− | ; | + | ; 6. Write Functional testing test cases. |
== Project Workflow == | == Project Workflow == |