Revision: 53657
http://brlcad.svn.sourceforge.net/brlcad/?rev=53657&view=rev
Author: n_reed
Date: 2012-11-13 15:54:38 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
pass lod plot routines a precomputed sample spacing (i.e. pixel width)
Modified Paths:
--------------
brlcad/trunk/include/raytrace.h
brlcad/trunk/src/librt/primitives/ell/ell.c
brlcad/trunk/src/librt/primitives/primitive_util.c
brlcad/trunk/src/librt/primitives/tgc/tgc.c
Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h 2012-11-13 15:39:31 UTC (rev 53656)
+++ brlcad/trunk/include/raytrace.h 2012-11-13 15:54:38 UTC (rev 53657)
@@ -1974,7 +1974,7 @@
struct bu_list *vhead;
const struct bn_tol *tol;
fastf_t view_size;
- fastf_t view_samples;
+ fastf_t sample_spacing;
};
/**
Modified: brlcad/trunk/src/librt/primitives/ell/ell.c
===================================================================
--- brlcad/trunk/src/librt/primitives/ell/ell.c 2012-11-13 15:39:31 UTC (rev
53656)
+++ brlcad/trunk/src/librt/primitives/ell/ell.c 2012-11-13 15:54:38 UTC (rev
53657)
@@ -762,16 +762,17 @@
const struct rt_ell_internal *ell,
const struct rt_view_info *info)
{
- fastf_t samples_per_mm;
- fastf_t radius, radius_samples;
+ fastf_t avg_radius, avg_radius_samples;
+ fastf_t ell_mag_a, ell_mag_b, ell_mag_c;
- samples_per_mm = sqrt(info->view_samples) / info->view_size;
+ ell_mag_a = MAGNITUDE(ell->a);
+ ell_mag_b = MAGNITUDE(ell->b);
+ ell_mag_c = MAGNITUDE(ell->c);
- radius = fabs((MAGNITUDE(ell->a) + MAGNITUDE(ell->b) + MAGNITUDE(ell->c))
- / 3.0);
- radius_samples = radius * samples_per_mm;
+ avg_radius = (ell_mag_a + ell_mag_b + ell_mag_c) / 3.0;
+ avg_radius_samples = avg_radius / info->sample_spacing;
- /* (2 * PI * radius_samples) would give us the number of times we expect
+ /* (2 * PI * avg_radius_samples) would give us the number of times we
expect
* our ellipse curves to be sampled by the view. This is sufficient to
* produce a very good rasterized image, but it is actually overkill.
*
@@ -782,7 +783,7 @@
* without reducing the apparent quality of the rasterized curve, we just
* use this empirical calculation.
*/
- return pow(bn_twopi * radius_samples, .55);
+ return pow(bn_twopi * avg_radius_samples, .55);
}
int
Modified: brlcad/trunk/src/librt/primitives/primitive_util.c
===================================================================
--- brlcad/trunk/src/librt/primitives/primitive_util.c 2012-11-13 15:39:31 UTC
(rev 53656)
+++ brlcad/trunk/src/librt/primitives/primitive_util.c 2012-11-13 15:54:38 UTC
(rev 53657)
@@ -86,7 +86,7 @@
ip->idb_meth->ft_bbox(ip, &bbox_min, &bbox_max, info->tol);
primitive_diagonal_mm = DIST_PT_PT(bbox_min, bbox_max);
- samples_per_mm = sqrt(info->view_samples) / info->view_size;
+ samples_per_mm = 1.0 / info->sample_spacing;
diagonal_samples = samples_per_mm * primitive_diagonal_mm;
return diagonal_samples;
Modified: brlcad/trunk/src/librt/primitives/tgc/tgc.c
===================================================================
--- brlcad/trunk/src/librt/primitives/tgc/tgc.c 2012-11-13 15:39:31 UTC (rev
53656)
+++ brlcad/trunk/src/librt/primitives/tgc/tgc.c 2012-11-13 15:54:38 UTC (rev
53657)
@@ -1835,18 +1835,23 @@
tgc_points_per_ellipse(const struct rt_db_internal *ip, const struct
rt_view_info *info)
{
struct rt_tgc_internal *tgc;
- fastf_t samples_per_mm, avg_axis_len, avg_axis_samples;
+ fastf_t avg_axis_len, avg_axis_samples;
+ fastf_t tgc_mag_a, tgc_mag_b, tgc_mag_c, tgc_mag_d;
RT_CK_DB_INTERNAL(ip);
tgc = (struct rt_tgc_internal *)ip->idb_ptr;
RT_TGC_CK_MAGIC(tgc);
- avg_axis_len = (2.0 * (MAGNITUDE(tgc->a) + MAGNITUDE(tgc->b) +
- MAGNITUDE(tgc->c) + MAGNITUDE(tgc->d))) / 4.0;
+ tgc_mag_a = MAGNITUDE(tgc->a);
+ tgc_mag_b = MAGNITUDE(tgc->b);
+ tgc_mag_c = MAGNITUDE(tgc->c);
+ tgc_mag_d = MAGNITUDE(tgc->d);
- samples_per_mm = sqrt(info->view_samples) / info->view_size;
- avg_axis_samples = samples_per_mm * avg_axis_len;
+ avg_axis_len = (2.0 * (tgc_mag_a + tgc_mag_b + tgc_mag_c + tgc_mag_d))
+ / 4.0;
+ avg_axis_samples = avg_axis_len / info->sample_spacing;
+
return pow(avg_axis_samples * M_PI, .55);
}
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