BRL-CAD provides more than two dozen types of geometry ''primitives'' such as ellipsoids, boxes, and cones. Every primitive is described by a collection of callback functions, for example rt_ell_bbox() returns the bounding box dimensions for an ellipsoid. Wikipedia, Wolfram Mathworld, and various other math sites (and research papers) around the web include the equations for most of our basic primitives while others are a little more difficult to compute.
References:
- http://en.wikipedia.org/wiki/Volume
- http://mathworld.wolfram.com/
- http://www.dtic.mil/cgi-bin/GetTRDoc?AD=AD0274936
- include/raytrace.h: See ft_volume callback defined in rt_functab structure
Code:
- src/librt/primitives/bot/bot.c (implement your function here)
- src/librt/primitives/table.c (add a reference to your function here)
This task involves writing a new callback function that takes an rt_db_internal object and calculates the volume (units are mm^3). There are numerous examples in our code where we compute volume for other primitives. Submit a patch file the may be applied cleanly.
If you succeed, a follow-on task may be created to enable and validate your function.
File name/URL | File size | Date submitted | |
---|---|---|---|
tmp_bot_vol-602668554.patch | 3.4 KB | November 21 2013 05:29 UTC | |
bot_vol_2.patch | 3.3 KB | November 23 2013 19:42 UTC |
I would like to work on this task.
This task has been assigned to Johannes Schulte. You have 72 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
Wouldn't it be a good idea to initialize volume first to 0? I know other primitives don't initialize it either.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
Johannes,
Upon quick inspection, it looks like you calculate total surface area, not volume? Or is this based on the tetrahedron method where you use the surface normal to add/subtract tetrahedron areas?
I kind of see the latter in your calculations, but that implies we'll need some protections in place for non-closed meshes. Basically, it just amounts to adding a check that tests whether a mesh is in volume mode (closed) or surface mode with a thickness.
Congratulations, this task has been completed successfully.
You've been credited in our authorship documentation that is shipped and installed with every copy of BRL-CAD. Feel free to join our brlcad-news mailing list to see announcements related to your participation in GCI or to stay involved in BRL-CAD development (feel free to join brlcad-devel too): https://lists.sourceforge.net/lists/listinfo/brlcad-news
The calculation for the volume is based on the surface area of each face : http://en.wikipedia.org/wiki/Polyhedron#Volume