Revision: 76834
http://sourceforge.net/p/brlcad/code/76834
Author: starseeker
Date: 2020-08-18 20:07:39 +0000 (Tue, 18 Aug 2020)
Log Message:
-----------
Back out the exposure of the point inside/outside test - needs more design
thought.
Modified Paths:
--------------
brlcad/trunk/include/analyze/pnts.h
brlcad/trunk/src/libanalyze/CMakeLists.txt
brlcad/trunk/src/libanalyze/polygonizer.c
brlcad/trunk/src/libged/CMakeLists.txt
brlcad/trunk/src/libged/pnts/pnts.cpp
brlcad/trunk/src/libged/pnts_util.c
brlcad/trunk/src/libged/pnts_util.h
brlcad/trunk/src/libged/tests/CMakeLists.txt
Removed Paths:
-------------
brlcad/trunk/src/libanalyze/pnt_inside.c
brlcad/trunk/src/libged/cg/
brlcad/trunk/src/libged/tests/cg_tests.g
Modified: brlcad/trunk/include/analyze/pnts.h
===================================================================
--- brlcad/trunk/include/analyze/pnts.h 2020-08-18 16:26:30 UTC (rev 76833)
+++ brlcad/trunk/include/analyze/pnts.h 2020-08-18 20:07:39 UTC (rev 76834)
@@ -65,13 +65,6 @@
ANALYZE_EXPORT int analyze_obj_to_pnts(struct rt_pnts_internal *rpnts, double
*avg_thickness, struct db_i *dbip,
const char *obj, struct bn_tol *tol, int
flags, int max_pnts, int max_time, int verbosity);
-
-/**
- * Given an application structure and a test point, use ray sampling to
determine
- * if the point is inside (on or within) or outside the volume described.
- */
-ANALYZE_EXPORT int analyze_pnt_in_vol(point_t *p, struct application *ap, int
on_is_in);
-
__END_DECLS
#endif /* ANALYZE_PNTS_H */
Modified: brlcad/trunk/src/libanalyze/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libanalyze/CMakeLists.txt 2020-08-18 16:26:30 UTC (rev
76833)
+++ brlcad/trunk/src/libanalyze/CMakeLists.txt 2020-08-18 20:07:39 UTC (rev
76834)
@@ -45,7 +45,6 @@
nirt/diff.cpp
obj_to_pnts.cpp
overlaps.c
- pnt_inside.c
polygonizer.c
raydiff.c
#find_subtracted_shapes.cpp
Deleted: brlcad/trunk/src/libanalyze/pnt_inside.c
===================================================================
--- brlcad/trunk/src/libanalyze/pnt_inside.c 2020-08-18 16:26:30 UTC (rev
76833)
+++ brlcad/trunk/src/libanalyze/pnt_inside.c 2020-08-18 20:07:39 UTC (rev
76834)
@@ -1,159 +0,0 @@
-/* P N T _ I N S I D E . C
- * BRL-CAD
- *
- * Copyright (c) 2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file pnt_inside.c
- *
- * Brief description
- *
- */
-
-#include "common.h"
-
-#include "raytrace.h"
-#include "analyze.h"
-
-static void
-_tgc_hack_fix(struct partition *part, struct soltab *stp) {
- /* hack fix for bad tgc surfaces - avoids a logging crash, which is
probably something else altogether... */
- if (bu_strncmp("rec", stp->st_meth->ft_label, 3) == 0 || bu_strncmp("tgc",
stp->st_meth->ft_label, 3) == 0) {
-
- /* correct invalid surface number */
- if (part->pt_inhit->hit_surfno < 1 || part->pt_inhit->hit_surfno > 3) {
- part->pt_inhit->hit_surfno = 2;
- }
- if (part->pt_outhit->hit_surfno < 1 || part->pt_outhit->hit_surfno > 3)
{
- part->pt_outhit->hit_surfno = 2;
- }
- }
-}
-
-
-static int
-in_out_hit(struct application *ap, struct partition *partH, struct seg
*UNUSED(segs))
-{
- struct partition *part = partH->pt_forw;
- struct soltab *stp = part->pt_inseg->seg_stp;
-
- int *ret = (int *)(ap->a_uptr);
-
- RT_CK_APPLICATION(ap);
-
- _tgc_hack_fix(part, stp);
-
- if (part->pt_inhit->hit_dist < 0) {
- (*ret) = -1;
- }
-
- if (NEAR_ZERO(part->pt_inhit->hit_dist, VUNITIZE_TOL)) {
- (*ret) = 1;
- }
-
- return 0;
-}
-
-static int
-in_out_miss(struct application *UNUSED(ap))
-{
- return 0;
-}
-
-int
-analyze_pnt_in_vol(point_t *p, struct application *ap, int on_is_in)
-{
- int i;
- int fret = 1;
- int dir_results[6] = {0, 0, 0, 0, 0, 0};
- int (*a_hit)(struct application *, struct partition *, struct seg *);
- int (*a_miss)(struct application *);
- void *uptr_stash;
-
- vect_t mx, my, mz, px, py, pz;
- VSET(mx, -1, 0, 0);
- VSET(my, 0, -1, 0);
- VSET(mz, 0, 0, -1);
- VSET(px, 1, 0, 0);
- VSET(py, 0, 1, 0);
- VSET(pz, 0, 0, 1);
-
- /* reuse existing application, just cache pre-existing hit routines and
- * substitute our own */
- a_hit = ap->a_hit;
- a_miss = ap->a_miss;
- uptr_stash = ap->a_uptr;
-
- ap->a_hit = in_out_hit;
- ap->a_miss = in_out_miss;
-
- VMOVE(ap->a_ray.r_pt, *p);
-
- /* Check the six directions to see if any of them indicate we are inside */
-
- /* -x */
- ap->a_uptr = &(dir_results[0]);
- VMOVE(ap->a_ray.r_dir, mx);
- (void)rt_shootray(ap);
- /* -y */
- ap->a_uptr = &(dir_results[1]);
- VMOVE(ap->a_ray.r_dir, my);
- (void)rt_shootray(ap);
- /* -z */
- ap->a_uptr = &(dir_results[2]);
- VMOVE(ap->a_ray.r_dir, mz);
- (void)rt_shootray(ap);
- /* x */
- ap->a_uptr = &(dir_results[3]);
- VMOVE(ap->a_ray.r_dir, px);
- (void)rt_shootray(ap);
- /* y */
- ap->a_uptr = &(dir_results[4]);
- VMOVE(ap->a_ray.r_dir, py);
- (void)rt_shootray(ap);
- /* z */
- ap->a_uptr = &(dir_results[5]);
- VMOVE(ap->a_ray.r_dir, pz);
- (void)rt_shootray(ap);
-
- for (i = 0; i < 6; i++) {
- if (on_is_in) {
- if (dir_results[i] != 0)
- fret = -1;
- } else {
- if (dir_results[i] < 0)
- fret = -1;
- }
- }
-
- /* restore application */
- ap->a_hit = a_hit;
- ap->a_miss = a_miss;
- ap->a_uptr = uptr_stash;
-
- return fret;
-}
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
-
Modified: brlcad/trunk/src/libanalyze/polygonizer.c
===================================================================
--- brlcad/trunk/src/libanalyze/polygonizer.c 2020-08-18 16:26:30 UTC (rev
76833)
+++ brlcad/trunk/src/libanalyze/polygonizer.c 2020-08-18 20:07:39 UTC (rev
76834)
@@ -399,7 +399,7 @@
}
-static void
+HIDDEN void
_polygonizer_tgc_hack_fix(struct partition *part, struct soltab *stp) {
/* hack fix for bad tgc surfaces - avoids a logging crash, which is
probably something else altogether... */
if (bu_strncmp("rec", stp->st_meth->ft_label, 3) == 0 || bu_strncmp("tgc",
stp->st_meth->ft_label, 3) == 0) {
@@ -414,7 +414,7 @@
}
}
-static int
+HIDDEN int
first_hit(struct application *ap, struct partition *PartHeadp, struct seg
*UNUSED(segs))
{
struct partition *part = PartHeadp->pt_forw;
@@ -627,11 +627,99 @@
bu_free(m, "mesh");
}
-static int
+
+HIDDEN int
+in_out_hit(struct application *ap, struct partition *partH, struct seg
*UNUSED(segs))
+{
+ struct partition *part = partH->pt_forw;
+ struct soltab *stp = part->pt_inseg->seg_stp;
+
+ int *ret = (int *)(ap->a_uptr);
+
+ RT_CK_APPLICATION(ap);
+
+ _polygonizer_tgc_hack_fix(part, stp);
+
+ if (part->pt_inhit->hit_dist < 0) {
+ (*ret) = -1;
+ }
+
+ return 0;
+}
+
+int
+in_out_miss(struct application *UNUSED(ap))
+{
+ return 0;
+}
+
+int
pnt_in_out(point_t *p, void *d)
{
+ int i;
+ int fret = 1;
+ int dir_results[6] = {0, 0, 0, 0, 0, 0};
struct application *ap = (struct application *)d;
- return analyze_pnt_in_vol(p, ap, 0);
+ int (*a_hit)(struct application *, struct partition *, struct seg *);
+ int (*a_miss)(struct application *);
+ void *uptr_stash;
+
+ vect_t mx, my, mz, px, py, pz;
+ VSET(mx, -1, 0, 0);
+ VSET(my, 0, -1, 0);
+ VSET(mz, 0, 0, -1);
+ VSET(px, 1, 0, 0);
+ VSET(py, 0, 1, 0);
+ VSET(pz, 0, 0, 1);
+
+ /* reuse existing application, just cache pre-existing hit routines and
+ * substitute our own */
+ a_hit = ap->a_hit;
+ a_miss = ap->a_miss;
+ uptr_stash = ap->a_uptr;
+
+ ap->a_hit = in_out_hit;
+ ap->a_miss = in_out_miss;
+
+ VMOVE(ap->a_ray.r_pt, *p);
+
+ /* Check the six directions to see if any of them indicate we are inside */
+
+ /* -x */
+ ap->a_uptr = &(dir_results[0]);
+ VMOVE(ap->a_ray.r_dir, mx);
+ (void)rt_shootray(ap);
+ /* -y */
+ ap->a_uptr = &(dir_results[1]);
+ VMOVE(ap->a_ray.r_dir, my);
+ (void)rt_shootray(ap);
+ /* -z */
+ ap->a_uptr = &(dir_results[2]);
+ VMOVE(ap->a_ray.r_dir, mz);
+ (void)rt_shootray(ap);
+ /* x */
+ ap->a_uptr = &(dir_results[3]);
+ VMOVE(ap->a_ray.r_dir, px);
+ (void)rt_shootray(ap);
+ /* y */
+ ap->a_uptr = &(dir_results[4]);
+ VMOVE(ap->a_ray.r_dir, py);
+ (void)rt_shootray(ap);
+ /* z */
+ ap->a_uptr = &(dir_results[5]);
+ VMOVE(ap->a_ray.r_dir, pz);
+ (void)rt_shootray(ap);
+
+ for (i = 0; i < 6; i++) {
+ if (dir_results[i] < 0) fret = -1;
+ }
+
+ /* restore application */
+ ap->a_hit = a_hit;
+ ap->a_miss = a_miss;
+ ap->a_uptr = uptr_stash;
+
+ return fret;
}
/**** An Implicit Surface Polygonizer ****/
Modified: brlcad/trunk/src/libged/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libged/CMakeLists.txt 2020-08-18 16:26:30 UTC (rev
76833)
+++ brlcad/trunk/src/libged/CMakeLists.txt 2020-08-18 20:07:39 UTC (rev
76834)
@@ -147,7 +147,6 @@
add_subdirectory(brep)
add_subdirectory(cat)
add_subdirectory(cc)
-add_subdirectory(cg)
add_subdirectory(check)
add_subdirectory(clone)
add_subdirectory(coil)
Modified: brlcad/trunk/src/libged/pnts/pnts.cpp
===================================================================
--- brlcad/trunk/src/libged/pnts/pnts.cpp 2020-08-18 16:26:30 UTC (rev
76833)
+++ brlcad/trunk/src/libged/pnts/pnts.cpp 2020-08-18 20:07:39 UTC (rev
76834)
@@ -1163,7 +1163,7 @@
int opt_ret = 0;
int opt_argc = argc;
struct bu_opt_desc d[2];
- const char * const pnt_subcommands[] = {"gen", "inside", "read", "tri",
"wn", "write", NULL};
+ const char * const pnt_subcommands[] = {"gen", "read", "tri", "wn",
"write", NULL};
const char * const *subcmd;
BU_OPT(d[0], "h", "help", "", NULL, &print_help, "Print help
and exit");
@@ -1221,7 +1221,6 @@
}
len = strlen(argv[0]);
-
if (bu_strncmp(argv[0], "tri", len) == 0) return _pnts_to_bot(gedp, argc,
argv);
if (bu_strncmp(argv[0], "gen", len) == 0) return _obj_to_pnts(gedp, argc,
argv);
Modified: brlcad/trunk/src/libged/pnts_util.c
===================================================================
--- brlcad/trunk/src/libged/pnts_util.c 2020-08-18 16:26:30 UTC (rev 76833)
+++ brlcad/trunk/src/libged/pnts_util.c 2020-08-18 20:07:39 UTC (rev 76834)
@@ -392,91 +392,6 @@
}
}
-void *
-_ged_pnts_dup(void *point, rt_pnt_type type)
-{
- void *npnt = NULL;
- struct pnt *pstd, *pstdnew = NULL;
- struct pnt_color *pc, *pcnew = NULL;
- struct pnt_scale *ps, *psnew = NULL;
- struct pnt_normal *pn, *pnnew = NULL;
- struct pnt_color_scale *pcs, *pcsnew = NULL;
- struct pnt_color_normal *pcn, *pcnnew = NULL;
- struct pnt_scale_normal *psn, *psnnew = NULL;
- struct pnt_color_scale_normal *pcsn, *pcsnnew = NULL;
-
- switch (type) {
- case RT_PNT_TYPE_PNT:
- pstd = (struct pnt *)point;
- npnt = _ged_pnts_new_pnt(type);
- pstdnew = (struct pnt *)npnt;
- VMOVE(pstdnew->v, pstd->v);
- break;
- case RT_PNT_TYPE_COL:
- pc = (struct pnt_color *)point;
- npnt = _ged_pnts_new_pnt(type);
- pcnew = (struct pnt_color *)npnt;
- VMOVE(pcnew->v, pc->v);
- pcnew->c.buc_rgb[0] = pc->c.buc_rgb[0];
- pcnew->c.buc_rgb[1] = pc->c.buc_rgb[1];
- pcnew->c.buc_rgb[2] = pc->c.buc_rgb[2];
- break;
- case RT_PNT_TYPE_SCA:
- ps = (struct pnt_scale *)point;
- npnt = _ged_pnts_new_pnt(type);
- psnew = (struct pnt_scale *)npnt;
- VMOVE(psnew->v, ps->v);
- psnew->s = ps->s;
- break;
- case RT_PNT_TYPE_NRM:
- pn = (struct pnt_normal *)point;
- npnt = _ged_pnts_new_pnt(type);
- pnnew = (struct pnt_normal *)npnt;
- VMOVE(pnnew->v, pn->v);
- VMOVE(pnnew->n, pn->n);
- break;
- case RT_PNT_TYPE_COL_SCA:
- pcs = (struct pnt_color_scale *)point;
- npnt = _ged_pnts_new_pnt(type);
- pcsnew = (struct pnt_color_scale *)npnt;
- VMOVE(pcsnew->v, pcs->v);
- pcsnew->c.buc_rgb[0] = pcs->c.buc_rgb[0];
- pcsnew->c.buc_rgb[1] = pcs->c.buc_rgb[1];
- pcsnew->c.buc_rgb[2] = pcs->c.buc_rgb[2];
- pcsnew->s = pcs->s;
- break;
- case RT_PNT_TYPE_COL_NRM:
- pcn = (struct pnt_color_normal *)point;
- npnt = _ged_pnts_new_pnt(type);
- pcnnew = (struct pnt_color_normal *)npnt;
- VMOVE(pcnnew->v, pcn->v);
- VMOVE(pcnnew->n, pcn->n);
- break;
- case RT_PNT_TYPE_SCA_NRM:
- psn = (struct pnt_scale_normal *)point;
- npnt = _ged_pnts_new_pnt(type);
- psnnew = (struct pnt_scale_normal *)npnt;
- VMOVE(psnnew->v, psn->v);
- psnnew->s = psn->s;
- VMOVE(psnnew->n, psn->n);
- break;
- case RT_PNT_TYPE_COL_SCA_NRM:
- pcsn = (struct pnt_color_scale_normal *)point;
- npnt = _ged_pnts_new_pnt(type);
- pcsnnew = (struct pnt_color_scale_normal *)npnt;
- VMOVE(pcsnnew->v, pcsn->v);
- pcsnnew->c.buc_rgb[0] = pcsn->c.buc_rgb[0];
- pcsnnew->c.buc_rgb[1] = pcsn->c.buc_rgb[1];
- pcsnnew->c.buc_rgb[2] = pcsn->c.buc_rgb[2];
- pcsnnew->s = pcsn->s;
- VMOVE(pcsnnew->n, pcsn->n);
- break;
- default:
- break;
- }
- return npnt;
-}
-
/*
* Local Variables:
* tab-width: 8
Modified: brlcad/trunk/src/libged/pnts_util.h
===================================================================
--- brlcad/trunk/src/libged/pnts_util.h 2020-08-18 16:26:30 UTC (rev 76833)
+++ brlcad/trunk/src/libged/pnts_util.h 2020-08-18 20:07:39 UTC (rev 76834)
@@ -60,8 +60,6 @@
GED_EXPORT extern void _ged_pnts_add(struct rt_pnts_internal *pnts, void
*point);
-GED_EXPORT extern void * _ged_pnts_dup(void *point, rt_pnt_type t);
-
__END_DECLS
#endif //LIBGED_PNT_GED_PRIVATE_H
Modified: brlcad/trunk/src/libged/tests/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libged/tests/CMakeLists.txt 2020-08-18 16:26:30 UTC
(rev 76833)
+++ brlcad/trunk/src/libged/tests/CMakeLists.txt 2020-08-18 20:07:39 UTC
(rev 76834)
@@ -13,7 +13,6 @@
lint_tests.g
obb_tests.g
ged_tests.g
- cg_tests.g
)
CMAKEFILES(CMakeLists.txt)
Deleted: brlcad/trunk/src/libged/tests/cg_tests.g
===================================================================
(Binary files differ)
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