Implement a volume function for elliptical hyperboloids (EHY)BRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: SeanTags:

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.

Uploaded Work
File name/URLFile sizeDate submitted
ehy-volume.patch2.9 KBNovember 27 2013 08:54 UTC
ehy-volume2.patch2.9 KBNovember 28 2013 10:24 UTC
Comments
Benjamin Kaiseron November 22 2013 12:50 UTCTask Claimed

I would like to work on this task.

Mandeep Kaur on November 22 2013 12:55 UTCTask Assigned

This task has been assigned to Benjamin Kaiser. You have 72 hours to complete this task, good luck!

Benjamin Kaiseron November 22 2013 12:57 UTCCheck Volume

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

Sean on November 22 2013 16:56 UTCgqa and analyze

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.

Benjamin Kaiseron November 22 2013 23:39 UTCc value

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

Benjamin Kaiseron November 22 2013 23:45 UTCClaim Removed

The claim on this task has been removed, someone else can claim it now.

agkphysicson November 27 2013 06:25 UTCTask Claimed

I would like to work on this task.

Daniel Rossberg on November 27 2013 08:04 UTCTask Assigned

This task has been assigned to agkphysics. You have 72 hours to complete this task, good luck!

agkphysicson November 27 2013 08:54 UTCReady for review

The work on this task is ready to be reviewed.

Sean on November 28 2013 07:20 UTCawesome derivation

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é.

Sean on November 28 2013 07:20 UTCTask Needs More Work

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.

agkphysicson November 28 2013 10:25 UTCReady for review

The work on this task is ready to be reviewed.

agkphysicson November 28 2013 10:28 UTCAuthorship

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.

Daniel Rossberg on November 28 2013 20:07 UTCTask Closed

Congratulations, this task has been completed successfully.