Implement a centroid function for right hyperbolic cylinders (RHC)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/rhc/rhc.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
rhc_centroid.patch1.8 KBNovember 21 2013 01:30 UTC
rhc_centroid_rev1.patch1.8 KBNovember 21 2013 02:33 UTC
rhc_centroid_rev2.patch2.0 KBNovember 21 2013 03:34 UTC
rhc_centroid_rev3.patch2.0 KBNovember 22 2013 00:41 UTC
Comments
Andrewon November 19 2013 00:29 UTCTask Claimed

I would like to work on this task.

Gauravjeet Singh on November 19 2013 00:29 UTCTask Assigned

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

Andrewon November 21 2013 01:30 UTCReady for review

The work on this task is ready to be reviewed.

Daniel Rossberg on November 21 2013 02:18 UTCNot bad

I havn't teted it yet but it looks not bad.  However, first you need to fix some coding style issies:


- the indents are inconsistent (there are sometimes 4 speces where a tab is needed)


- there are blank lines (which is ok) whith white-space charachters (which isn't ok)

Daniel Rossberg on November 21 2013 02:18 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.

Andrewon November 21 2013 02:33 UTCReady for review

The work on this task is ready to be reviewed.

Andrewon November 21 2013 03:34 UTC

Sorry. I found an error. Please consider rhc_centroid_rev2.patch.

Daniel Rossberg on November 21 2013 23:01 UTCDeadline extended

The deadline of the task has been extended with 2 days and 0 hours.

Daniel Rossberg on November 21 2013 23:11 UTCAgain the indents

Remember our indent style: Indents are 4 characters, tabs are 8 characters, i.e. use a tab for every double indent.  In my message before I refered to lines which neded a double indent (8 spaces, i.e. one tab) but got only 4 space indent.

Daniel Rossberg on November 21 2013 23:11 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.

Andrewon November 22 2013 00:41 UTCReady for review

The work on this task is ready to be reviewed.

Sean on November 23 2013 01:57 UTClooks great

Andrew, that looks fantastic now.  Your change has already been applied to our trunk sources in r58629 and you've been credited in our authorship documentation with the code contribution.  If you provide your full name, we'll credit you more appropriately.


Also, if you're interested, we can add another task to test and verify whether your centroid calculations are correct or not.  Let us know. :)


 

Sean on November 23 2013 01:57 UTCTask Closed

Congratulations, this task has been completed successfully.

Andrewon November 23 2013 02:18 UTCThanks.

My full name is Andrew Tan.


 


I would be interested in completing the follow-on task.