Revision: 54062
http://brlcad.svn.sourceforge.net/brlcad/?rev=54062&view=rev
Author: d_rossberg
Date: 2012-12-14 14:08:38 +0000 (Fri, 14 Dec 2012)
Log Message:
-----------
applied changes according to Google Code-in tasks
- IMPLEMENT A PRIMITIVE CENTROID FUNCTION ... FOR HYPERBOLOIDS OF ONE SHEET
(HYP) (http://google-melange.appspot.com/gci/task/view/google/gci2012/8030210)
- IMPLEMENT A PRIMITIVE VOLUME FUNCTION ... FOR HYPERBOLOIDS OF ONE SHEET (HYP)
(http://google-melange.appspot.com/gci/task/view/google/gci2012/7987216)
performed by Aaron Keesing. Added rt_hyp_surf_area() stub to enable analyze in
mged. The new functions (HYP centroid and volume) may now be tested via mged.
Modified Paths:
--------------
brlcad/trunk/src/libged/analyze.c
brlcad/trunk/src/librt/primitives/hyp/hyp.c
brlcad/trunk/src/librt/primitives/table.c
Modified: brlcad/trunk/src/libged/analyze.c
===================================================================
--- brlcad/trunk/src/libged/analyze.c 2012-12-13 23:38:02 UTC (rev 54061)
+++ brlcad/trunk/src/libged/analyze.c 2012-12-14 14:08:38 UTC (rev 54062)
@@ -1458,6 +1458,10 @@
analyze_sketch(gedp, ip);
break;
+ case ID_HYP:
+ analyze_general(gedp, ip);
+ break;
+
default:
bu_vls_printf(gedp->ged_result_str, "\nanalyze: unable to process %s
solid\n",
rt_functab[ip->idb_type].ft_name);
Modified: brlcad/trunk/src/librt/primitives/hyp/hyp.c
===================================================================
--- brlcad/trunk/src/librt/primitives/hyp/hyp.c 2012-12-13 23:38:02 UTC (rev
54061)
+++ brlcad/trunk/src/librt/primitives/hyp/hyp.c 2012-12-14 14:08:38 UTC (rev
54062)
@@ -1364,6 +1364,57 @@
}
+/**
+ * R T _ H Y P _ C E N T R O I D
+ */
+void
+rt_hyp_centroid(point_t *cent, const struct rt_db_internal *ip)
+{
+ if (cent != NULL && ip != NULL) {
+ struct rt_hyp_internal *hip;
+
+ RT_CK_DB_INTERNAL(ip);
+ hip = (struct rt_hyp_internal *)ip->idb_ptr;
+ RT_HYP_CK_MAGIC(hip);
+
+ VSCALE(*cent, hip->hyp_Hi, 0.5);
+ VADD2(*cent, hip->hyp_Vi, *cent);
+ }
+}
+
+
+/**
+ * R T _ H Y P _ S U R F _ A R E A
+ *
+ * only the stub to make analyze happy
+ * TODO: needs an implementation
+ */
+void
+rt_hyp_surf_area(fastf_t *UNUSED(area), const struct rt_db_internal
*UNUSED(ip)) {}
+
+
+/**
+ * R T _ H Y P _ V O L U M E
+ */
+void
+rt_hyp_volume(fastf_t *volume, const struct rt_db_internal *ip)
+{
+ if (volume != NULL || ip != NULL) {
+ struct rt_hyp_internal *hip;
+ struct hyp_specific *hyp;
+
+ RT_CK_DB_INTERNAL(ip);
+ hip = (struct rt_hyp_internal *)ip->idb_ptr;
+ RT_HYP_CK_MAGIC(hip);
+
+ hyp = hyp_internal_to_specific(hip);
+ *volume = M_PI * hyp->hyp_r1 * hyp->hyp_r2 * hyp->hyp_Hmag * 2 *
+ (1 + hyp->hyp_Hmag * hyp->hyp_Hmag * hyp->hyp_c * hyp->hyp_c / (12
* hyp->hyp_r1 * hyp->hyp_r1));
+ bu_free(hyp, "hyp volume");
+ }
+}
+
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/librt/primitives/table.c
===================================================================
--- brlcad/trunk/src/librt/primitives/table.c 2012-12-13 23:38:02 UTC (rev
54061)
+++ brlcad/trunk/src/librt/primitives/table.c 2012-12-14 14:08:38 UTC (rev
54062)
@@ -1792,9 +1792,9 @@
NULL,
rt_hyp_params,
rt_hyp_bbox,
- NULL,
- NULL,
- NULL,
+ rt_hyp_volume,
+ rt_hyp_surf_area,
+ rt_hyp_centroid,
},
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits