Revision: 53671
          http://brlcad.svn.sourceforge.net/brlcad/?rev=53671&view=rev
Author:   n_reed
Date:     2012-11-14 14:28:47 +0000 (Wed, 14 Nov 2012)
Log Message:
-----------
try to satisfy spacing requirements

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/tgc/tgc.c

Modified: brlcad/trunk/src/librt/primitives/tgc/tgc.c
===================================================================
--- brlcad/trunk/src/librt/primitives/tgc/tgc.c 2012-11-14 06:06:06 UTC (rev 
53670)
+++ brlcad/trunk/src/librt/primitives/tgc/tgc.c 2012-11-14 14:28:47 UTC (rev 
53671)
@@ -1835,7 +1835,7 @@
 tgc_points_per_ellipse(const struct rt_db_internal *ip, const struct 
rt_view_info *info)
 {
     struct rt_tgc_internal *tgc;
-    fastf_t avg_axis_len, avg_axis_samples;
+    fastf_t avg_radius, avg_circumference;
     fastf_t tgc_mag_a, tgc_mag_b, tgc_mag_c, tgc_mag_d;
 
     RT_CK_DB_INTERNAL(ip);
@@ -1847,18 +1847,16 @@
     tgc_mag_c = MAGNITUDE(tgc->c);
     tgc_mag_d = MAGNITUDE(tgc->d);
 
-    avg_axis_len = (2.0 * (tgc_mag_a + tgc_mag_b + tgc_mag_c + tgc_mag_d))
-       / 4.0;
+    avg_radius = (tgc_mag_a + tgc_mag_b + tgc_mag_c + tgc_mag_d) / 4.0;
+    avg_circumference = bn_twopi * avg_radius;
 
-    avg_axis_samples = avg_axis_len / info->point_spacing;
-
-    return pow(avg_axis_samples * M_PI, .55);
+    return avg_circumference / info->point_spacing;
 }
 
 int
 rt_tgc_adaptive_plot(struct rt_db_internal *ip, const struct rt_view_info 
*info)
 {
-    int points_per_ellipse;
+    int points_per_ellipse, connecting_lines;
     struct rt_tgc_internal *tip;
     struct ellipse ellipse1, ellipse2;
 
@@ -1869,7 +1867,7 @@
 
     points_per_ellipse = tgc_points_per_ellipse(ip, info);
 
-    if (points_per_ellipse < 4) {
+    if (points_per_ellipse < 6) {
        point_t p;
 
        VADD2(p, tip->v, tip->h);
@@ -1891,8 +1889,14 @@
     plot_ellipse(info->vhead, ellipse2.center, ellipse2.axis_a, 
ellipse2.axis_b,
                 points_per_ellipse);
 
-    draw_lines_between_ellipses(info->vhead, ellipse1, ellipse2, 
points_per_ellipse / 2);
+    connecting_lines = primitive_curve_count(ip, info);
 
+    if (connecting_lines < 2) {
+       connecting_lines = 2;
+    }
+
+    draw_lines_between_ellipses(info->vhead, ellipse1, ellipse2, 
connecting_lines);
+
     return 0;
 }
 

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

Reply via email to