Revision: 53666
http://brlcad.svn.sourceforge.net/brlcad/?rev=53666&view=rev
Author: n_reed
Date: 2012-11-13 21:42:11 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
add primitive routine for calculating a curve count based on bbox dimensions
and curve spacing parameter
Modified Paths:
--------------
brlcad/trunk/src/librt/librt_private.h
brlcad/trunk/src/librt/primitives/primitive_util.c
Modified: brlcad/trunk/src/librt/librt_private.h
===================================================================
--- brlcad/trunk/src/librt/librt_private.h 2012-11-13 21:35:20 UTC (rev
53665)
+++ brlcad/trunk/src/librt/librt_private.h 2012-11-13 21:42:11 UTC (rev
53666)
@@ -104,6 +104,10 @@
fastf_t p,
int num_new_points);
+extern fastf_t primitive_curve_count(
+ struct rt_db_internal *ip,
+ const struct rt_view_info *info);
+
extern int approximate_hyperbolic_curve(
struct rt_pt_node *pts,
fastf_t a,
Modified: brlcad/trunk/src/librt/primitives/primitive_util.c
===================================================================
--- brlcad/trunk/src/librt/primitives/primitive_util.c 2012-11-13 21:35:20 UTC
(rev 53665)
+++ brlcad/trunk/src/librt/primitives/primitive_util.c 2012-11-13 21:42:11 UTC
(rev 53666)
@@ -92,6 +92,33 @@
return diagonal_samples;
}
+/**
+ * Estimate the number of evenly spaced cross-section curves needed to meet a
+ * target curve spacing.
+ */
+fastf_t
+primitive_curve_count(
+ struct rt_db_internal *ip,
+ const struct rt_view_info *info)
+{
+ point_t bbox_min, bbox_max;
+ fastf_t x_len, y_len, z_len, avg_len;
+
+ if (!ip->idb_meth->ft_bbox) {
+ return 0.0;
+ }
+
+ ip->idb_meth->ft_bbox(ip, &bbox_min, &bbox_max, info->tol);
+
+ x_len = fabs(bbox_max[X] - bbox_min[X]);
+ y_len = fabs(bbox_max[Y] - bbox_min[Y]);
+ z_len = fabs(bbox_max[Z] - bbox_min[Z]);
+
+ avg_len = (x_len + y_len + z_len) / 3.0;
+
+ return avg_len / info->curve_spacing;
+}
+
/* Calculate the length of the shortest distance between a point and a line in
* the y-z plane.
*/
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits