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. 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. The primitives that do not already have a centroid callback are itemized in following. References:
Code:
|
File name/URL | File size | Date submitted | |
---|---|---|---|
ehycentroid.patch | 1.2 KB | December 19 2012 10:16 UTC | |
ehycentroid2.patch | 1.5 KB | December 20 2012 00:36 UTC |
I would like to work on this task.
This task has been assigned to Alex Ozer. You have 72 hours to complete this task, good luck!
I've been busy with schoolwork recently, is there any chance to get an extension on this task?
Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.
The claim on this task has been removed, someone else can claim it now.
Yes, an extension can be or could have been granted. You just unclaimed it too quickly. ;)
Of course, you can always claim it again if nobody else does.
I would like to work on this task.
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 Richard Akira Heru. You have 72 hours to complete this task, good luck!
Melange has detected that the initial deadline has passed and it has set the task status to ActionNeeded. The student has 24 hours to submit the work before the task is reopened and sent back to the pool for other students to claim.
Melange has detected that the final deadline has passed and it has reopened the task.
I would like to work on this task.
This task has been assigned to Aaron Keesing. You have 72 hours to complete this task, good luck!
I believe I may have found a general formula for finding the centroid of the hyperboloid, if it is oriented nicely and I can work out the equation. I couldn't find any specific formula for a hyperboloid's centroid on the internet, so I am trying to use some general formulas for finding the centroid of any shapes, then using the equation of the cross-sectional hyperbola to find its centroid, and taking advantage of the hyperboloid's symmetry.
Could you please indicate whether I am on the right track or if I am getting way off with this method, or am I missing something completely obvious?
I may need an extenstion on this task as I am also doing holiday work for school and am only able to work on this in the evenings, but I'll see how I get on.
Thanks
Aaron K
So oriented nicely, the elliptical hyperboloid is elliptical. You know the center of the elliptical part is the center of the ellipse, so you can immediately constain your solution to the center of a bounded hyperbola, no? You also know that the centroid will be on the centerline of the hyperbola due to symmetry. That greatly simplifies the problem, no? I'd bet someone's already done the math on answers.yahoo.com for some homework assignment. ;)
The deadline of the task has been extended with 1 days and 0 hours.
The work on this task is ready to be reviewed.
I'm sorry if the code looks messy, both math-wise and code-wise. I believe the seemingly complicated math is what is necessary to find the centroid.
On the other hand, the numerous variables in the code are so it doesn't get even more messy than it already is! If there is anything I could change from a code perspective to make it more efficient or less messy, please tell me.
Thanks
Aaron K
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.
Could you please provide us a document where you describe your formula? I.e. basic methodology and equations and how you derived your formula from this?
The source code looks ok so far.
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.
Melange has detected that the final deadline has passed and it has reopened the task.
Aaron, you're encouraged to reclaim the task so we can mark you as having completing it. Even a picture of a piece of paper where you worked out the math would be good. It would be great to include the derivation in the source code comments. ;)
I would like to work on this task.
This task has been assigned to Aaron Keesing. You have 72 hours to complete this task, good luck!
Here is the link to a document which hopefully explains how I derived the formula.
https://docs.google.com/open?id=0BydeQ6BPlVejRWt6NlJLVDl0d28
Sean, I'm not sure how I would include such a lengthy derivation in comments in the source code. Perhaps I could simply put a link to the above document maybe?
Aaron K
The work on this task is ready to be reviewed.
Congratulations, this task has been completed successfully.
Aaron, that looks fantastic, but it certainly could be included in the source code comments. See http://brlcad.svn.sourceforge.net/viewvc/brlcad/brlcad/trunk/src/librt/primitives/ehy/ehy.c for an example of another primitive with equations, definitions, and derivations spelled out.
Since I cannot upload more files, here is the link to the patch containing the brief derivation in the comments.
https://docs.google.com/open?id=0BydeQ6BPlVejbkQ1VW1Laktka1E
I tried to make it as short as possible while still being able to understand, but have included a link the document as well.