Implement a centroid function for gridded volumes (VOL)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 tricky to compute.

References:

  • http://en.wikipedia.org/wiki/Centroid
  • http://mathworld.wolfram.com/
  • include/raytrace.h: See ft_centroid callback defined in the rt_functab structure

Code:

  • src/librt/primitives/vol/vol.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 its centroid (as a point_t 3D point). There are numerous examples in our code where we compute centroids for other primtiives. 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
centroid.patch1.4 KBDecember 17 2013 02:59 UTC
vol-centroid.patch1.3 KBDecember 17 2013 15:37 UTC
Comments
Anton Georgievon November 22 2013 16:19 UTCTask Claimed

I would like to work on this task.

Mandeep Kaur on November 22 2013 16:20 UTCTask Assigned

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

Anton Georgievon November 22 2013 17:20 UTCClaim Removed

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

Jacob Burroughson December 14 2013 03:07 UTCTask Claimed

I would like to work on this task.

Sean on December 14 2013 03:10 UTCTask Assigned

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

Jacob Burroughson December 16 2013 23:14 UTCClaim Removed

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

Jacob Burroughson December 17 2013 02:48 UTCTask Claimed

I would like to work on this task.

Sean on December 17 2013 02:58 UTCTask Assigned

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

Jacob Burroughson December 17 2013 03:00 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 17 2013 04:54 UTCminor stylistic

Jacob, this looks good to me.  Only issues I note are cosmetic code conventions issues that we cover in our HACKING file.  Please try for the following changes:



  • space after all commas (usually around operators too like =, , +=, etc)

  • space before '{' (the if line)

  • unnecessary /** */ comment before the function (not your fault, that was our old style)

  • indentation (should be 4spcs, 1tab, 1tab+4spcs, etc)


If you can't figure the last one out, that's okay but consistent indentation is considered critical for most software development projects, proprietary and open source codes.  It's a good "skill" to learn to recognize different conventions, to see them when reading code, and to adapt to them when writing code.


 

Sean on December 17 2013 04:54 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.

Jacob Burroughson December 17 2013 15:38 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 17 2013 16:55 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 17 2013 16:56 UTCapplied

Your patch was applied in r58969, excellent work.