Compare commits

...
49 Commits
Author SHA1 Message Date
Clifford Yapp 56d5e320dc Should be done with this branch now. (svn branch delete)
svn:revision:62159
svn:branch:bottie
svn:account:starseeker
2014-08-15 13:15:10 +00:00
Erik Greenwald 234f57103e MFC 42842
svn:revision:42883
svn:branch:bottie
svn:account:erikgreenwald
2011-02-02 14:20:27 +00:00
Erik Greenwald 9719bde58e mimic rt_bot_minpieces for TIE algorithm
svn:revision:42849
svn:branch:bottie
svn:account:erikgreenwald
2011-02-01 21:35:17 +00:00
Erik Greenwald 74c8984713 throw in the global variables
svn:revision:42814
svn:branch:bottie
svn:account:erikgreenwald
2011-01-31 23:06:37 +00:00
Erik Greenwald b607d0fe57 incorporate changes from trunk
svn:revision:42800
svn:branch:bottie
svn:account:erikgreenwald
2011-01-31 20:36:19 +00:00
Erik Greenwald 0998a26201 warning quellage
svn:revision:42737
svn:branch:bottie
svn:account:erikgreenwald
2011-01-28 21:58:56 +00:00
Erik Greenwald 2dea1a87c5 MFC 42604
svn:revision:42609
svn:branch:bottie
svn:account:erikgreenwald
2011-01-25 23:23:11 +00:00
Erik Greenwald 062f52ede2 MFC 42305
svn:revision:42306
svn:branch:bottie
svn:account:erikgreenwald
2011-01-15 19:46:41 +00:00
Erik Greenwald 58eef97515 remote hitsort (should already be sorted from tie). test for maxhits earlier.
svn:revision:41904
svn:branch:bottie
svn:account:erikgreenwald
2011-01-03 18:40:30 +00:00
Erik Greenwald ff5f34cb44 de-HIDDEN rt_bot_makesegs() so btg.c can call it (didn't show up in debug build, but does in optimized)
svn:revision:41843
svn:branch:bottie
svn:account:erikgreenwald
2010-12-29 21:14:50 +00:00
Erik Greenwald efec572b7c force min/max instead of trusting them to be 0ish
svn:revision:41842
svn:branch:bottie
svn:account:erikgreenwald
2010-12-29 20:47:14 +00:00
Erik Greenwald 8ec4046775 add tri_specific for segment normal info
svn:revision:41840
svn:branch:bottie
svn:account:erikgreenwald
2010-12-29 20:23:40 +00:00
Erik Greenwald 022c30c391 renormalize against trunk as well as possible
svn:revision:41822
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 23:03:18 +00:00
Erik Greenwald 9b0cc79190 MFC 41816
svn:revision:41821
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 22:06:35 +00:00
Erik Greenwald 25147f58d8 MFC 41816
svn:revision:41820
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 22:01:27 +00:00
Erik Greenwald d6e65d2cf5 MFC 41816
svn:revision:41819
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 21:58:38 +00:00
Erik Greenwald b42637c409 MFC 41816
svn:revision:41818
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 21:52:14 +00:00
Erik Greenwald c20684b379 MFC 41816
svn:revision:41817
svn:branch:bottie
svn:account:erikgreenwald
2010-12-28 21:48:08 +00:00
Erik Greenwald e8c89b3daa rearrange some stuff, clean things up
svn:revision:41540
svn:branch:bottie
svn:account:erikgreenwald
2010-12-07 19:53:08 +00:00
Erik Greenwald 78e69f6cd7 remove old cache stuff
svn:revision:41532
svn:branch:bottie
svn:account:erikgreenwald
2010-12-07 14:00:50 +00:00
Erik Greenwald cf152223e0 don't print info from lib
svn:revision:41474
svn:branch:bottie
svn:account:erikgreenwald
2010-11-29 22:08:24 +00:00
Erik Greenwald ad946abb5b split actual bbox info from fuzzed info
svn:revision:41473
svn:branch:bottie
svn:account:erikgreenwald
2010-11-29 22:07:19 +00:00
Erik Greenwald abcf4a4014 migrate data packing for tie into the prep phase instead of the load phase
svn:revision:41472
svn:branch:bottie
svn:account:erikgreenwald
2010-11-29 21:59:00 +00:00
Erik Greenwald 01ba252bf0 set freed memory ptr to NULL
svn:revision:41471
svn:branch:bottie
svn:account:erikgreenwald
2010-11-29 19:49:02 +00:00
Erik Greenwald 4f9d57efb3 actually return the newly allocated memory from the alloc func...
svn:revision:41470
svn:branch:bottie
svn:account:erikgreenwald
2010-11-29 19:47:28 +00:00
Erik Greenwald edee29be28 cleaning up some merge issues
svn:revision:41404
svn:branch:bottie
svn:account:erikgreenwald
2010-11-19 14:23:10 +00:00
Erik Greenwald e38887bf2d MFC 41388
svn:revision:41389
svn:branch:bottie
svn:account:erikgreenwald
2010-11-17 13:54:39 +00:00
Erik Greenwald b3f4626319 MFC 41333
svn:revision:41349
svn:branch:bottie
svn:account:erikgreenwald
2010-11-15 15:06:04 +00:00
Erik Greenwald c841db93d8 test for bad data field
svn:revision:40969
svn:branch:bottie
svn:account:erikgreenwald
2010-10-12 17:06:40 +00:00
Erik Greenwald bd6e7cae51 test to see if malloc succeeded.
svn:revision:40968
svn:branch:bottie
svn:account:erikgreenwald
2010-10-12 17:05:34 +00:00
Erik Greenwald 7a9dcd5be0 force double mode
svn:revision:40967
svn:branch:bottie
svn:account:erikgreenwald
2010-10-12 17:03:26 +00:00
Erik Greenwald 80a0f58562 meh, more changes
svn:revision:40547
svn:branch:bottie
svn:account:erikgreenwald
2010-09-13 14:55:38 +00:00
Erik Greenwald 876c7b0c40 construct more stuff in prep, and use it in shoot
svn:revision:40546
svn:branch:bottie
svn:account:erikgreenwald
2010-09-13 13:47:41 +00:00
Erik Greenwald 3f32ee7540 start wiring together the hit shtuff
svn:revision:40443
svn:branch:bottie
svn:account:erikgreenwald
2010-09-02 21:04:08 +00:00
Erik Greenwald 7bc82a0ef9 return value of prep. Do not call prep in import5.
svn:revision:40438
svn:branch:bottie
svn:account:erikgreenwald
2010-09-02 19:53:01 +00:00
Erik Greenwald adfc323aa4 wire up vertex data and call bottie push
svn:revision:40436
svn:branch:bottie
svn:account:erikgreenwald
2010-09-02 19:48:09 +00:00
Erik Greenwald fecc00dcff update prototypes
svn:revision:40435
svn:branch:bottie
svn:account:erikgreenwald
2010-09-02 19:47:12 +00:00
Erik Greenwald 8dc5fa5d72 MFC 39973:40402
svn:revision:40410
svn:branch:bottie
svn:account:erikgreenwald
2010-09-01 18:28:54 +00:00
Erik Greenwald 237189ff60 add stubs to move to the glue style thing. Still needs an interface layer to abstract the type specific typedef stuff, but closer to non-hack, methinks.
svn:revision:40152
svn:branch:bottie
svn:account:erikgreenwald
2010-08-13 17:08:04 +00:00
Erik Greenwald 915d91abc7 start wiring up conditional TIE execution
svn:revision:40119
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 21:31:35 +00:00
Erik Greenwald 51b04d211c bind the TIE instances
svn:revision:40118
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 21:31:20 +00:00
Erik Greenwald 2c42dfaca1 stub the TIE instance into both bot representations.
svn:revision:40117
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 21:31:06 +00:00
Erik Greenwald 41795f11cb reflect the exodus of tie from this dark twisty maze
svn:revision:40112
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 19:41:51 +00:00
Erik Greenwald c9f61eb6ac add tie.h to the list
svn:revision:40111
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 19:40:52 +00:00
Erik Greenwald a2f2adf17e compile in the tie stuff with float/double hack
svn:revision:40110
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 19:40:17 +00:00
Erik Greenwald f75b6e7b1a move tie.h into include/
svn:revision:40109
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 19:39:16 +00:00
Erik Greenwald 41196e36ed move tie engine into librt
svn:revision:40103
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 13:55:39 +00:00
Erik Greenwald 017e03bf20 MFC
svn:revision:40101
svn:branch:bottie
svn:account:erikgreenwald
2010-08-11 13:42:09 +00:00
Erik Greenwald 48ba96c560 Bottie.
svn:revision:39973
svn:branch:bottie
svn:account:erikgreenwald
2010-07-30 13:43:21 +00:00
146 changed files with 408 additions and 794 deletions
+1
View File
@@ -0,0 +1 @@
/.deps␍/Makefile␍/Makefile.in␍/aclocal.m4␍/autom4te.cache␍/config.*␍/configure␍/install.*.log␍/libtool␍/ltmain.sh␍/so_locations␍/.settings␍/.project␍/.cdtproject␍/.cproject
+2 -1
View File
@@ -17,7 +17,8 @@ brlcadinclude_required = \
rtfunc.h \
rtgeom.h \
rtserver.h \
tclcad.h
tclcad.h \
tie.h
brlcadinclude_wanted = \
analyze.h \
+1 -1
View File
@@ -37,7 +37,7 @@ struct bot_specific {
genptr_t bot_facelist; /* head of linked list */
genptr_t *bot_facearray; /* head of face array */
size_t bot_tri_per_piece; /* log # tri per peice. 1 << bot_ltpp is tri per piece */
void *tie; /* FIXME: horrible blind cast, points to one in rt_bot_internal */
};
RT_EXPORT BU_EXTERN(void rt_bot_prep_pieces,
+2
View File
@@ -1354,6 +1354,7 @@ struct rt_piecelist {
/* Used to set globals declared in bot.c */
#define RT_DEFAULT_MINPIECES 32
#define RT_DEFAULT_TRIS_PER_PIECE 4
#define RT_DEFAULT_MINTIE 0xffffffff
/**
* R E S O U R C E
@@ -5951,6 +5952,7 @@ RT_EXPORT extern fastf_t rt_cline_radius;
/* defined in bot.c */
RT_EXPORT extern size_t rt_bot_minpieces;
RT_EXPORT extern size_t rt_bot_tri_per_piece;
RT_EXPORT extern size_t rt_bot_mintie;
RT_EXPORT BU_EXTERN(int rt_bot_sort_faces,
(struct rt_bot_internal *bot,
size_t tris_per_piece));
+1
View File
@@ -590,6 +590,7 @@ struct rt_bot_internal
* "normals" array, one per face
* vertex [num_face_normals*3]
*/
void *tie; /* FIXME: blind casting. TIE needs to move from TIE_FUNC to XGLUE before this can not suck. */
};
struct rt_bot_list {
+1 -1
View File
@@ -123,7 +123,7 @@ struct tie_s {
unsigned int kdmethod; /* Optimal or Fast */
/* all tfloat altered stuff should be at the end. */
TIE_3 min, max;
vect_t mid;
vect_t amin, amax, mid;
fastf_t radius;
};
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+36 -28
View File
@@ -8,14 +8,8 @@ AM_CFLAGS = \
-I${top_srcdir}/src/adrt/librender \
${TCL_CPPFLAGS}
lib_LTLIBRARIES = libtie.la librender.la
libtie_la_LIBADD = ${BU} ${BU_LIBS}
libtie_la_SOURCES = \
libtie/tie0.c \
libtie/tie1.c \
libtie/tie_kdtree0.c \
libtie/tie_kdtree1.c
bin_PROGRAMS = adrt_master adrt_slave
lib_LTLIBRARIES = librender.la
librender_la_SOURCES = \
load.c \
@@ -46,10 +40,34 @@ librender_la_SOURCES = \
librender/texture_stack.c
librender_la_LIBADD = \
libtie.la \
${GCV} \
${GCV_LIBS}
adrt_master_SOURCES = \
master/compnet.c \
master/dispatcher.c \
master/tienet_master.c \
master/master.c
adrt_master_LDADD = \
${RT} \
${BU} \
${LIBNETWORK} \
${LIBTHREAD} \
${LIBBSD} \
${LIBM} \
${LIBZ}
adrt_slave_SOURCES = \
slave/slave.c \
slave/tienet_slave.c
adrt_slave_LDADD = \
${RT} \
${LIBNETWORK} \
${LIBTHREAD} \
librender.la
tieincludedir = $(includedir)/tie
tieinclude_HEADERS = \
adrt.h \
@@ -59,13 +77,17 @@ tieinclude_HEADERS = \
librender/render_internal.h \
librender/render_util.h \
librender/texture.h \
librender/texture_internal.h \
libtie/tie.h
librender/texture_internal.h
noinst_HEADERS = \
libtie/tieprivate.h \
load.h \
tienet.h
tienet.h \
master/compnet.h \
master/dispatcher.h \
master/tienet_master.h \
master/master.h \
slave/slave.h \
slave/tienet_slave.h
pkglibdir = $(libdir)/isst
@@ -91,21 +113,7 @@ pkglibdir = $(libdir)/isst
EXTRA_DIST = \
isst.h \
isst.tcl \
isst_tcltk.c \
libtie/tie.c \
libtie/tie_kdtree.c \
master/compnet.h \
master/master.h \
master/tienet_master.c \
master/dispatcher.c \
master/master.c \
master/dispatcher.h \
master/tienet_master.h \
master/compnet.c \
slave/tienet_slave.h \
slave/slave.h \
slave/slave.c \
slave/tienet_slave.c
isst_tcltk.c
LINT=splint $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
lint:
-36
View File
@@ -1,36 +0,0 @@
/* T I E 0 . C
* BRL-CAD
*
* Copyright (c) 2008-2011 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 tie0.c
* tie0.c
*
*/
#include <bu.h>
#include "tie.h"
TIE_EXPORT int tie_check_degenerate = 0;
#ifdef TIE_PRECISION
# undef TIE_PRECISION
#endif
#define TIE_PRECISION 0
#include "./tie.c"
#undef TIE_PRECISION
-29
View File
@@ -1,29 +0,0 @@
/* T I E 1 . C
* BRL-CAD
*
* Copyright (c) 2008-2011 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 tie1.c
* tie1.c
*
*/
#define TIE_PRECISION 1
#include "./tie.c"
#undef TIE_PRECISION
-33
View File
@@ -1,33 +0,0 @@
/* T I E _ K D T R E E 0 . C
* BRL-CAD
*
* Copyright (c) 2008-2011 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 tie_kdtree0.c
* tie_kdtree0.c
*
*/
#define TIE_PRECISION 0
#include "tie.h"
TIE_EXPORT fastf_t TIE_PREC;
#include "./tie_kdtree.c"
#undef TIE_PRECISION
-28
View File
@@ -1,28 +0,0 @@
/* T I E _ K D T R E E 1 . C
* BRL-CAD
*
* Copyright (c) 2008-2011 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 tie_kdtree1.c
* tie_kdtree1.c
*
*/
#define TIE_PRECISION 1
#include "./tie_kdtree.c"
#undef TIE_PRECISION
+1 -1
View File
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
#include "libtie/tie.h"
#include "tie.h"
#include "load.h"
uint32_t slave_load_mesh_num;
+1 -1
View File
@@ -47,7 +47,7 @@
#include "rtgeom.h"
#include "raytrace.h"
#include "libtie/tie.h"
#include "tie.h"
#include "adrt.h"
#include "adrt_struct.h"
+1 -1
View File
@@ -41,7 +41,7 @@
#endif
#include "bio.h"
#include "libtie/tie.h"
#include "tie.h"
#include "adrt.h"
#include "tienet.h"
+1 -1
View File
@@ -30,7 +30,7 @@
#endif
#include "bio.h"
#include "libtie/tie.h"
#include "tie.h"
#include "adrt.h"
#include "tienet_master.h"
+1 -1
View File
@@ -47,7 +47,7 @@
# include <netdb.h>
#endif
#include "libtie/tie.h"
#include "tie.h"
#include "adrt.h"
#include "tienet.h"
#include "tienet_master.h"
+1 -2
View File
@@ -39,11 +39,10 @@
# include <getopt.h>
#endif
#include "libtie/tie.h"
#include "tie.h"
#include "adrt.h"
#include "camera.h"
#include "adrt.h"
#include "tie.h"
#include "render_util.h"
#include "slave.h"
Executable → Regular
View File
Executable → Regular
View File
View File
View File
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+6 -2
View File
@@ -93,6 +93,8 @@ librt_nil_la_SOURCES = \
primitives/bot/bot.c \
primitives/bot/bot_brep.cpp \
primitives/bot/bot_mirror.c \
primitives/bot/btg.c \
primitives/bot/btgf.c \
primitives/brep/brep.cpp \
primitives/brep/brep_debug.cpp \
primitives/bspline/bspline.cpp \
@@ -278,9 +280,9 @@ parsetest_LDADD = \
noinst_HEADERS = \
opennurbs_ext.h \
primitives/fixpt.h \
primitives/bot/btg.h \
primitives/brep/brep_debug.h \
primitives/fixpt.h \
primitives/metaball/metaball.h \
primitives/revolve/revolve.h \
primitives/xxx/xxx.h
@@ -302,6 +304,8 @@ EXTRA_DIST = \
namegen.c \
pmalloc.c \
primitives/bot/g_bot_include.c \
primitives/bot/tie.c \
primitives/bot/tie_kdtree.c \
timer-nt.c \
timer52brl.c \
timerhep.c \
+5
View File
@@ -283,6 +283,11 @@ fastf_t rt_cline_radius = (fastf_t)-1.0;
*/
size_t rt_bot_minpieces = RT_DEFAULT_MINPIECES;
/**
* minimum number of bot for TIE
*/
size_t rt_bot_mintie = RT_DEFAULT_MINTIE;
/**
* minimum triangles per piece
*/
+21 -6
View File
@@ -45,6 +45,8 @@
#define GLUE(_a, _b) _a ## _b
#define XGLUE(_a, _b) GLUE(_a, _b)
#include "tie.h"
#include "btg.h" /* for the bottie_ functions */
#define MAXHITS 128
@@ -68,7 +70,7 @@
/* forward declarations needed for the included routines below */
HIDDEN int
int
rt_bot_makesegs(
struct hit *hits,
size_t nhits,
@@ -203,11 +205,12 @@ rt_bot_prep(struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
bot_ip = (struct rt_bot_internal *)ip->idb_ptr;
RT_BOT_CK_MAGIC(bot_ip);
if (bot_ip->bot_flags & RT_BOT_USE_FLOATS) {
if ( bot_ip->num_faces >= rt_bot_mintie && (bot_ip->face_normals != NULL || bot_ip->orientation != RT_BOT_UNORIENTED) )
return bottie_prep_double(stp, bot_ip, rtip);
else if (bot_ip->bot_flags & RT_BOT_USE_FLOATS)
return rt_bot_prep_float(stp, bot_ip, rtip);
} else {
else
return rt_bot_prep_double(stp, bot_ip, rtip);
}
}
@@ -261,7 +264,7 @@ rt_bot_unoriented_segs(struct hit *hits,
* Given an array of hits, make segments out of them. Exactly how
* this is to be done depends on the mode of the BoT.
*/
HIDDEN int
int
rt_bot_makesegs(struct hit *hits, size_t nhits, struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead, struct rt_piecestate *psp)
{
struct bot_specific *bot = (struct bot_specific *)stp->st_specific;
@@ -298,7 +301,9 @@ rt_bot_shot(struct soltab *stp, struct xray *rp, struct application *ap, struct
{
struct bot_specific *bot = (struct bot_specific *)stp->st_specific;
if (bot->bot_flags & RT_BOT_USE_FLOATS) {
if (bot->tie != NULL) {
return bottie_shot_double(stp, rp, ap, seghead);
} else if (bot->bot_flags & RT_BOT_USE_FLOATS) {
return rt_bot_shot_float(stp, rp, ap, seghead);
} else {
return rt_bot_shot_double(stp, rp, ap, seghead);
@@ -420,6 +425,11 @@ rt_bot_free(struct soltab *stp)
struct bot_specific *bot =
(struct bot_specific *)stp->st_specific;
if (bot->tie != NULL) {
bottie_free_double(bot->tie);
bot->tie = NULL;
}
if (bot->bot_flags & RT_BOT_USE_FLOATS) {
rt_bot_free_float(bot);
} else {
@@ -976,6 +986,8 @@ rt_bot_import5(struct rt_db_internal *ip, const struct bu_external *ep, const fa
bip->num_face_normals = 0;
}
bip->tie = NULL;
return 0; /* OK */
}
@@ -1259,6 +1271,9 @@ rt_bot_ifree2(struct rt_bot_internal *bot_ip)
RT_BOT_CK_MAGIC(bot_ip);
bot_ip->magic = 0; /* sanity */
if (bot_ip->tie)
bot_ip->tie = NULL;
if (bot_ip->vertices) {
bu_free(bot_ip->vertices, "BOT vertices");
bot_ip->vertices = NULL;
+180
View File
@@ -0,0 +1,180 @@
/* B T G . C
* BRL-CAD
*
* Copyright (c) 2010-2010 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 btg.c
*
* the bot/tie glue.
*
*/
#define TIE_PRECISION 1
#include "common.h"
#include "raytrace.h"
#include "rtgeom.h"
#include "bot.h"
#include "tie.h"
#include "btg.h"
#include "tie.c"
#include "tie_kdtree.c"
int tie_check_degenerate = 0;
fastf_t TIE_PREC = 0.1;
int rt_bot_makesegs(struct hit *hits, size_t nhits, struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead, struct rt_piecestate *psp);
void *
bottie_allocn_double(unsigned long long ntri)
{
struct tie_s *tie;
tie = bu_malloc(sizeof(struct tie_s), "TIE");
if(tie == NULL)
return NULL;
tie_init1(tie, ntri, TIE_KDTREE_FAST);
return tie;
}
void
bottie_push_double(void *vtie, TIE_3 **tri, unsigned int ntri, void *u, unsigned int pstride)
{
struct tie_s *tie = (struct tie_s *)vtie;
tie_push1(tie, tri, ntri, u, pstride);
}
int
bottie_prep_double(struct soltab *stp, struct rt_bot_internal *bot_ip, struct rt_i *UNUSED(rtip))
{
struct tie_s *tie;
struct bot_specific *bot;
unsigned int i;
RT_BOT_CK_MAGIC(bot_ip);
BU_GETSTRUCT(bot, bot_specific);
stp->st_specific = (genptr_t)bot;
bot->bot_mode = bot_ip->mode;
bot->bot_orientation = bot_ip->orientation;
bot->bot_flags = bot_ip->bot_flags;
tie = bot_ip->tie = bot->tie = bottie_allocn_double(bot_ip->num_faces);
for(i=0;i< bot_ip->num_faces; i++) {
TIE_3 v, *vp;
vp = &v;
v.v[0] = bot_ip->vertices[bot_ip->faces[i*3+0]*3];
v.v[1] = bot_ip->vertices[bot_ip->faces[i*3+1]*3];
v.v[2] = bot_ip->vertices[bot_ip->faces[i*3+2]*3];
bottie_push_double((struct tie_s *)tie, &vp, 1, &i, 0);
}
tie_prep1((struct tie_s *)bot->tie);
VMOVE(stp->st_min, tie->amin);
VMOVE(stp->st_max, tie->amax);
VMOVE(stp->st_center, tie->mid);
stp->st_aradius = tie->radius;
stp->st_bradius = tie->radius;
return 0; /* always returning OK seems... bad. */
}
#define MAXHITS 128
struct hitdata_s {
int nhits;
struct hit hits[MAXHITS];
struct tri_specific ts[MAXHITS];
struct xray *rp;
};
static void *
hitfunc(struct tie_ray_s *UNUSED(ray), struct tie_id_s *id, struct tie_tri_s *UNUSED(tri), void *ptr)
{
struct hitdata_s *h = (struct hitdata_s *)ptr;
struct tri_specific *tsp;
struct hit *hp;
if(h->nhits > (MAXHITS-1)) {
bu_log("Too many hits!\n");
return (void *)1;
}
hp = &h->hits[h->nhits];
tsp = hp->hit_private = &h->ts[h->nhits];
h->nhits++;
hp->hit_magic = RT_HIT_MAGIC;
hp->hit_dist = id->dist;
VMOVE(tsp->tri_N, id->norm);
/* add hitdist into array and add one to nhits */
return NULL; /* continue firing */
}
int
bottie_shot_double(struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead)
{
struct bot_specific *bot;
struct tie_s *tie;
struct hitdata_s hitdata;
struct tie_id_s id;
struct tie_ray_s ray;
bot = (struct bot_specific *)stp->st_specific;
tie = (struct tie_s *)bot->tie;
hitdata.nhits = 0;
hitdata.rp = &ap->a_ray;
VMOVE(ray.pos, rp->r_pt);
VMOVE(ray.dir, rp->r_dir);
ray.depth = ray.kdtree_depth = 0;
tie_work1(tie, &ray, &id, hitfunc, &hitdata);
/* use hitfunc to build the hit list */
if(hitdata.nhits == 0)
return 0;
return rt_bot_makesegs(hitdata.hits, hitdata.nhits, stp, rp, ap, seghead, NULL);
}
void
bottie_free_double(void *vtie)
{
tie_free((struct tie_s *)vtie);
}
/*
* Local Variables:
* tab-width: 8
* mode: C
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+44
View File
@@ -0,0 +1,44 @@
/* B T G . H
* BRL-CAD
*
* Copyright (c) 2010-2010 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 btg.h
*
* the bot/tie glue.
*
*/
void bottie_push_double(void *vtie, TIE_3 **tri, unsigned int ntri, void *usr, unsigned int pstride);
int bottie_prep_double(struct soltab *stp, struct rt_bot_internal *bot, struct rt_i *rtip);
int bottie_shot_double(struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead);
void bottie_free_double(void *vtie);
void bottie_push_float(void *vtie, float **tri, unsigned int ntri, void *usr, unsigned int pstride);
int bottie_prep_float(struct soltab *stp, struct rt_bot_internal *bot, struct rt_i *rtip);
int bottie_shot_float(struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead);
void bottie_free_float(void *vtie);
/*
* Local Variables:
* tab-width: 8
* mode: C
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+96
View File
@@ -0,0 +1,96 @@
/* B T G F . C
* BRL-CAD
*
* Copyright (c) 2010-2010 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 btgf.c
*
* the bot/tie float glue.
*
*/
#include "common.h"
#define TIE_PRECISION 0
#include "raytrace.h"
#include "rtgeom.h"
#include "tie.h"
#include "btg.h"
#include "tie.c"
#include "tie_kdtree.c"
void *
bottie_allocn_float(unsigned long long ntri)
{
struct tie_s *tie;
tie = bu_malloc(sizeof(struct tie_s), "TIE");
if(tie == NULL)
return NULL;
tie_init(tie, ntri, TIE_KDTREE_FAST);
return (void *)tie;
}
void
bottie_push_float(void *UNUSED(vtie), float **UNUSED(tri), unsigned int UNUSED(ntri), void *UNUSED(usr), unsigned int UNUSED(pstride))
{
struct tie_s *tie = (struct tie_s *)vtie;
tie = NULL;
return;
}
int
bottie_prep_float(struct soltab *stp,struct rt_bot_internal *bot, struct rt_i *UNUSED(rtip))
{
struct tie_s *tie = (struct tie_s *)bot->tie;
tie_prep(tie);
VMOVE(stp->st_min, tie->min.v);
VMOVE(stp->st_max, tie->max.v);
VMOVE(stp->st_center, tie->mid);
stp->st_bradius = stp->st_aradius = tie->radius;
stp->st_specific = bot;
return 0;
}
#if 0
static int
hitfunc()
{
return 0;
}
#endif
int
bottie_shot_float(struct soltab *UNUSED(stp), register struct xray *UNUSED(rp), struct application *UNUSED(ap), struct seg *UNUSED(seghead))
{
/* use hitfunc to build the hit list */
return -1;
}
/*
* Local Variables:
* tab-width: 8
* mode: C
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+3
View File
@@ -763,11 +763,14 @@ rt_tcl_setup(Tcl_Interp *interp)
{
extern size_t rt_bot_minpieces; /* from globals.c */
extern size_t rt_bot_tri_per_piece; /* from globals.c */
extern size_t rt_bot_mintie; /* from globals.c */
Tcl_LinkVar(interp, "rt_bot_minpieces", (char *)&rt_bot_minpieces, TCL_LINK_WIDE_INT);
Tcl_LinkVar(interp, "rt_bot_tri_per_piece",
(char *)&rt_bot_tri_per_piece, TCL_LINK_WIDE_INT);
Tcl_LinkVar(interp, "rt_bot_mintie", (char *)&rt_bot_mintie, TCL_LINK_WIDE_INT);
}
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File

Some files were not shown because too many files have changed in this diff Show More