Revision: 45556
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45556&view=rev
Author:   r_weiss
Date:     2011-07-20 20:25:17 +0000 (Wed, 20 Jul 2011)

Log Message:
-----------
Updated function nmg_class_pt_s within file nmg_class.c. This change supports 
the prototype version of the nmg_triangulate_fu function. Within function 
nmg_class_pt_s it uses the raytracer to classify if a point is in, out or on a 
shell. During the computations of determining this, line intersection functions 
are used where some require finite line segments. To help resolve some of the 
computation problems I added a magnitude to the ray direction vector instead of 
the vector being a unit vector. The nmg model bounding box was used to 
determine the ray length. This is a work is progress. This change is disabled 
by default.

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

Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_class.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_class.c   2011-07-20 20:20:07 UTC 
(rev 45555)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_class.c   2011-07-20 20:25:17 UTC 
(rev 45556)
@@ -632,6 +632,11 @@
     vect_t projection_dir;
     int try=0;
     struct xray rp;
+#ifdef TRI_PROTOTYPE
+    fastf_t model_bb_max_width;
+    struct nmgregion *r;
+    point_t m_min_pt, m_max_pt; /* nmg model min and max points */
+#endif
 
     NMG_CK_SHELL(s);
     BN_CK_TOL(tol);
@@ -704,6 +709,18 @@
     VSUB2(region_diagonal, s->r_p->ra_p->max_pt, s->r_p->ra_p->min_pt);
     region_diameter = MAGNITUDE(region_diagonal);
 
+#ifdef TRI_PROTOTYPE
+    /* find the nmg model bounding box */
+    VSETALL(m_min_pt, MAX_FASTF);
+    VSETALL(m_max_pt, -MAX_FASTF);
+    for (BU_LIST_FOR(r, nmgregion, &s->r_p->m_p->r_hd)) {
+        NMG_CK_REGION(r);
+        VMIN(m_min_pt, r->ra_p->min_pt);
+        VMAX(m_max_pt, r->ra_p->max_pt);
+    }
+    model_bb_max_width = bn_dist_pt3_pt3(m_min_pt, m_max_pt);
+#endif
+
     /* Choose an unlikely direction */
     try = 0;
 retry:
@@ -720,9 +737,16 @@
               V3ARGS(pt), V3ARGS(projection_dir), region_diameter);
 
     VMOVE(rp.r_pt, pt);
+
+#ifdef TRI_PROTOTYPE
+    /* give the ray a length which is at least the max
+     * length of the nmg model bounding box.
+     */
+    VSCALE(rp.r_dir, projection_dir, model_bb_max_width * 1.25);
+#else
     VMOVE(rp.r_dir, projection_dir);
+#endif
 
-
     /* get NMG ray-tracer to tell us if start point is inside or outside */
     class = nmg_class_ray_vs_shell(&rp, s, in_or_out_only, tol);
     if (class == NMG_CLASS_Unknown) goto retry;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to