Revision: 65684
          http://sourceforge.net/p/brlcad/code/65684
Author:   starseeker
Date:     2015-07-27 17:01:48 +0000 (Mon, 27 Jul 2015)
Log Message:
-----------
Get the solid partitions function printing out some info.

Modified Paths:
--------------
    brlcad/trunk/src/libanalyze/analyze_private.h
    brlcad/trunk/src/libanalyze/tests/CMakeLists.txt
    brlcad/trunk/src/libanalyze/util.cpp

Modified: brlcad/trunk/src/libanalyze/analyze_private.h
===================================================================
--- brlcad/trunk/src/libanalyze/analyze_private.h       2015-07-27 17:01:00 UTC 
(rev 65683)
+++ brlcad/trunk/src/libanalyze/analyze_private.h       2015-07-27 17:01:48 UTC 
(rev 65684)
@@ -40,7 +40,6 @@
 typedef int (*hitfunc_t)(struct application *, struct partition *, struct seg 
*);
 typedef int (*missfunc_t)(struct application *);
 typedef int (*overlapfunc_t)(struct application *, struct partition *, struct 
region *, struct region *, struct partition *);
-typedef int (*nextstart_t)(int *);
 
 struct rt_gen_worker_vars {
     struct rt_i *rtip;
@@ -52,7 +51,6 @@
     overlapfunc_t foverlap;
     int step;       /* number of rays to be fired by this worker before 
calling back */
     int *ind_src;   /* source of starting index */
-    nextstart_t nstart; /* function to call to get next starting index */
     void *ptr; /* application specific info */
 };
 
@@ -61,6 +59,9 @@
 /* Returns count of rays in rays array */
 int analyze_get_bbox_rays(fastf_t **rays, point_t min, point_t max, struct 
bn_tol *tol);
 
+int
+analyze_get_solid_partitions(struct bu_ptbl *results, const fastf_t *rays, int 
ray_cnt,
+               struct db_i *dbip, const char *obj, struct bn_tol *tol);
 
 
 typedef struct xray * (*getray_t)(void *ptr);

Modified: brlcad/trunk/src/libanalyze/tests/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libanalyze/tests/CMakeLists.txt    2015-07-27 17:01:00 UTC 
(rev 65683)
+++ brlcad/trunk/src/libanalyze/tests/CMakeLists.txt    2015-07-27 17:01:48 UTC 
(rev 65684)
@@ -1,5 +1,6 @@
 BRLCAD_ADDEXEC(tester_density density.c "libanalyze;libbu" NO_INSTALL)
 BRLCAD_ADDEXEC(tester_raydiff raydiff.c "libanalyze;libbu" NO_INSTALL)
+BRLCAD_ADDEXEC(tester_sp solid_partitions.c "libanalyze;libbu" NO_INSTALL)
 
 CMAKEFILES(raydiff.g)
 

Modified: brlcad/trunk/src/libanalyze/util.cpp
===================================================================
--- brlcad/trunk/src/libanalyze/util.cpp        2015-07-27 17:01:00 UTC (rev 
65683)
+++ brlcad/trunk/src/libanalyze/util.cpp        2015-07-27 17:01:48 UTC (rev 
65684)
@@ -377,14 +377,22 @@
 
 // TODO - hit
 HIDDEN int
-sp_hit(struct application *ap, struct partition *UNUSED(PartHeadp), struct seg 
*UNUSED(segs))
+sp_hit(struct application *ap, struct partition *PartHeadp, struct seg 
*UNUSED(segs))
 {
-    RT_CK_APPLICATION(ap);
-    bu_log("hit");
+    struct partition *part;
+    fastf_t part_len = 0.0;
+    struct rt_gen_worker_vars *s = (struct rt_gen_worker_vars *)(ap->a_uptr);
+    struct solids_container *state = (struct solids_container *)(s->ptr);
+
+    for (part = PartHeadp->pt_forw; part != PartHeadp; part = part->pt_forw) {
+       part_len = part->pt_outhit->hit_dist - part->pt_inhit->hit_dist;
+       if (part_len > state->tol) {
+           bu_log("hit: t = %f to t = %f, len: %f\n", 
part->pt_inhit->hit_dist, part->pt_outhit->hit_dist, part_len);
+       }
+    }
     return 0;
 }
 
-// TODO - miss
 HIDDEN int
 sp_miss(struct application *ap)
 {
@@ -395,18 +403,22 @@
 // TODO - overlap
 HIDDEN int
 sp_overlap(struct application *ap,
-       struct partition *UNUSED(pp),
+       struct partition *pp,
        struct region *UNUSED(reg1),
        struct region *UNUSED(reg2),
        struct partition *UNUSED(hp))
 {
-    RT_CK_APPLICATION(ap);
-    bu_log("overlap");
+    struct rt_gen_worker_vars *s = (struct rt_gen_worker_vars *)(ap->a_uptr);
+    struct solids_container *state = (struct solids_container *)(s->ptr);
+    fastf_t part_len = pp->pt_outhit->hit_dist - pp->pt_inhit->hit_dist;
+    if (part_len > state->tol) {
+       bu_log("overlap: t = %f to t = %f, len: %f\n", pp->pt_inhit->hit_dist, 
pp->pt_outhit->hit_dist, part_len);
+    }
     return 0;
 }
 
 
-int
+extern "C" int
 analyze_get_solid_partitions(struct bu_ptbl *results, const fastf_t *rays, int 
ray_cnt,
        struct db_i *dbip, const char *obj, struct bn_tol *tol)
 {
@@ -436,6 +448,7 @@
        state[i].foverlap = sp_overlap;
        state[i].resp = &resp[i];
        state[i].ind_src = &ind;
+       state[i].step = (int)(ray_cnt/ncpus * 0.1);
        rt_init_resource(state[i].resp, i, rtip);
        /* local */
        local_state[i].tol = 0.5;

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


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to