Revision: 53440
http://brlcad.svn.sourceforge.net/brlcad/?rev=53440&view=rev
Author: r_weiss
Date: 2012-11-02 18:14:26 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------
Made changes to files "raytrace.h", "nmg_rt_segs.c" and "nmg_rt_isect.c" for
functions "unresolved", "check_hitstate", "nmg_rt_print_hitlist", "hit_ins",
"isect_ray_vertexuse" and "nmg_isect_ray_model". Did some code cleanup to help
avoid confusion between the head of a "hitmiss" bu_list and elements in the
bu_list. Fixed a bug in function "check_hitstate" causing NMG raytracing to
fail.
Modified Paths:
--------------
brlcad/trunk/include/raytrace.h
brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c
brlcad/trunk/src/librt/primitives/nmg/nmg_rt_segs.c
Modified: brlcad/trunk/include/raytrace.h
===================================================================
--- brlcad/trunk/include/raytrace.h 2012-11-02 04:55:46 UTC (rev 53439)
+++ brlcad/trunk/include/raytrace.h 2012-11-02 18:14:26 UTC (rev 53440)
@@ -4820,7 +4820,7 @@
/* From nmg_rt_isect.c */
-RT_EXPORT extern void nmg_rt_print_hitlist(struct hitmiss *hl);
+RT_EXPORT extern void nmg_rt_print_hitlist(struct bu_list *hd);
RT_EXPORT extern void nmg_rt_print_hitmiss(struct hitmiss *a_hit);
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c 2012-11-02
04:55:46 UTC (rev 53439)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_rt_isect.c 2012-11-02
18:14:26 UTC (rev 53440)
@@ -234,13 +234,13 @@
VPRINT("\tout_normal", a_hit->outbound_norm);
}
void
-nmg_rt_print_hitlist(struct hitmiss *hl)
+nmg_rt_print_hitlist(struct bu_list *hd)
{
struct hitmiss *a_hit;
bu_log("nmg/ray hit list:\n");
- for (BU_LIST_FOR(a_hit, hitmiss, &(hl->l))) {
+ for (BU_LIST_FOR(a_hit, hitmiss, hd)) {
nmg_rt_print_hitmiss(a_hit);
}
}
@@ -286,7 +286,7 @@
BU_LIST_INSERT(&a_hit->l, &newhit->l);
if (rt_g.NMG_debug & DEBUG_RT_ISECT)
- nmg_rt_print_hitlist((struct hitmiss *)&rd->rd_hit);
+ nmg_rt_print_hitlist(&rd->rd_hit);
}
@@ -1078,7 +1078,7 @@
ray_hit_vertex(rd, vu_p, NMG_VERT_UNKNOWN);
if (rt_g.NMG_debug & DEBUG_RT_ISECT) {
- nmg_rt_print_hitlist(rd->hitmiss[NMG_HIT_LIST]);
+ nmg_rt_print_hitlist((struct bu_list *)rd->hitmiss[NMG_HIT_LIST]);
}
return 1;
@@ -2401,7 +2401,7 @@
bu_log("ray missed NMG\n");
} else {
if (rt_g.NMG_debug & DEBUG_RT_ISECT)
- nmg_rt_print_hitlist((struct hitmiss*)&rd->rd_hit);
+ nmg_rt_print_hitlist(&rd->rd_hit);
}
}
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_rt_segs.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_rt_segs.c 2012-11-02 04:55:46 UTC
(rev 53439)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_rt_segs.c 2012-11-02 18:14:26 UTC
(rev 53440)
@@ -989,7 +989,7 @@
HIDDEN void
-unresolved(struct hitmiss *next_hit, struct bu_ptbl *a_tbl, struct bu_ptbl
*next_tbl, struct hitmiss *hd, struct ray_data *rd)
+unresolved(struct hitmiss *next_hit, struct bu_ptbl *a_tbl, struct bu_ptbl
*next_tbl, struct bu_list *hd, struct ray_data *rd)
{
struct hitmiss *hm;
@@ -999,7 +999,7 @@
bu_log("Unable to fix state transition--->\n");
bu_log("\tray start = (%f %f %f) dir = (%f %f %f)\n",
V3ARGS(rd->rp->r_pt), V3ARGS(rd->rp->r_dir));
- for (BU_LIST_FOR(hm, hitmiss, &hd->l)) {
+ for (BU_LIST_FOR(hm, hitmiss, hd)) {
if (hm == next_hit) {
bu_log("======= ======\n");
nmg_rt_print_hitmiss(hm);
@@ -1030,7 +1030,7 @@
HIDDEN int
-check_hitstate(struct hitmiss *hd, struct ray_data *rd)
+check_hitstate(struct bu_list *hd, struct ray_data *rd)
{
struct hitmiss *a_hit;
struct hitmiss *next_hit;
@@ -1041,10 +1041,10 @@
struct bu_ptbl *tbl_p = (struct bu_ptbl *)NULL;
long *long_ptr;
- BU_CK_LIST_HEAD(&hd->l);
+ BU_CK_LIST_HEAD(hd);
/* find that first "OUTSIDE" point */
- a_hit = BU_LIST_FIRST(hitmiss, &hd->l);
+ a_hit = BU_LIST_FIRST(hitmiss, hd);
NMG_CK_HITMISS(a_hit);
if (((a_hit->in_out & 0x0f0) >> 4) != NMG_RAY_STATE_OUTSIDE ||
@@ -1056,7 +1056,7 @@
V3ARGS(rd->rp->r_pt), V3ARGS(rd->rp->r_dir));
}
- while (a_hit != hd &&
+ while (BU_LIST_NOT_HEAD(a_hit, hd) &&
((a_hit->in_out & 0x0f0) >> 4) != NMG_RAY_STATE_OUTSIDE) {
NMG_CK_HITMISS(a_hit);
@@ -1070,7 +1070,7 @@
rd->ap->a_purpose);
a_hit = BU_LIST_PNEXT(hitmiss, a_hit);
}
- if (a_hit == hd) return 1;
+ if (BU_LIST_IS_HEAD(a_hit, hd)) return 1;
a_tbl = (struct bu_ptbl *)
bu_calloc(1, sizeof(struct bu_ptbl), "a_tbl");
@@ -1082,7 +1082,7 @@
bu_ptbl_init(next_tbl, 64, "next_tbl");
/* check the state transition on the rest of the hit points */
- while ((next_hit = BU_LIST_PNEXT(hitmiss, &a_hit->l)) != hd) {
+ while (BU_LIST_NOT_HEAD((next_hit = BU_LIST_PNEXT(hitmiss, &a_hit->l)),
hd)) {
NMG_CK_HITMISS(next_hit);
ibs = HMG_INBOUND_STATE(next_hit);
@@ -1189,7 +1189,7 @@
last_miss = 0;
- if (check_hitstate((struct hitmiss *)&rd->rd_hit, rd)) {
+ if (check_hitstate(&rd->rd_hit, rd)) {
NMG_FREE_HITLIST(&rd->rd_hit, rd->ap);
NMG_FREE_HITLIST(&rd->rd_miss, rd->ap);
return 0;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits