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/ehy/ehy.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 | |
---|---|---|---|
ehy-volume.patch | 2.9 KB | November 27 2013 08:54 UTC | |
ehy-volume2.patch | 2.9 KB | November 28 2013 10:24 UTC |
I would like to work on this task.
This task has been assigned to Benjamin Kaiser. You have 72 hours to complete this task, good luck!
How do I check the volume of an object using mged? or should I do it some other way? I want to test running it with an arb8 or something then testing it with my own volume cod for the ehy.
Thanks
If you enable your new volume function (in table.c), you should be able to test it with the 'analyze' command. You can verify whether the volume is being calculated correctly with the "gqa -Av" command (which uses a slow sampling method).
If you do end up validating your implementation and get it all working, let us know and we can create a specific follow-on task to enable/validate your function so you get credit for the extra work.
Okay, by using that command I have come to realise I was calculating the volume of an epp (Elliptic Paraboloid). How is the volume of an ellyptic hyperboloid supposed to be calculated? Any documents on the interenet draw it much different to brlcad: http://mathworld.wolfram.com/EllipticHyperboloid.html
The claim on this task has been removed, someone else can claim it now.
I would like to work on this task.
This task has been assigned to agkphysics. You have 72 hours to complete this task, good luck!
The work on this task is ready to be reviewed.
I don't know if it's right without spending some time with the math and some hands-on testing (which we won't have time to do for a while), but this is awesome. I hope it's right!
That said, I'd like to request one small improvement. The entire body of your function is in an if () block. It's generally better practice to keep scope to a minimum at all times. Please restructure the logic to perform parameter validation first. Example:
struct rt_ehy_internal *eip;
if (volume == NULL || ip == NULL || volume == NULL)
return;
eip = ...;
...
Make sense?
If you provide your full name, we'll credit you appropriately with this code contribution in our authorship documentation. Your choice, but most do as it's great for your resumé.
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.
My full name Aaron Keesing, but it looks like I am already in your AUTHORS file because I worked on BRL-CAD for last year's GCI as well.
Congratulations, this task has been completed successfully.