Implement a centroid function for extruded sketches (EXTRUDE)BRL-CAD
Status: ClosedTime to complete: 100 hrs Mentors: Deepak, DishankTags: C, code, centroid, math

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/extrude/extrude.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
task-extrude-centroid.diff3.0 KBDecember 02 2014 01:50 UTC
Comments
Andromeda Galaxyon December 1 2014 19:06 UTCTask Claimed

I would like to work on this task.

Sean on December 1 2014 19:06 UTCTask Assigned

This task has been assigned to Andromeda Galaxy. You have 100 hours to complete this task, good luck!

Andromeda Galaxyon December 2 2014 01:50 UTCReady for review

The work on this task is ready to be reviewed.

Sean on December 2 2014 02:11 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 2 2014 02:41 UTCfollow-on task

It's obviously a sampled approach, but the overall logic is sound.  The main limitation will be the volatility of the sample grid given a sketch with small features or unfortunate patterns.  A follow-on task was added if you want to try and address those concerns:  https://www.google-melange.com/gci/task/view/google/gci2014/5297789445603328