40 #if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE)
54 return( edges.
x()*edges.
y()*edges.
z()+
55 edges.
x()+edges.
y()+edges.
z());
65 }
else maxdepth=
btMax(maxdepth,depth);
161 }
while(0!=(prev=node->
parent));
200 return(prev?prev:pdbvt->
m_root);
239 for(
int i=0,ni=leaves.
size();i<ni;++i)
241 if(
btDot(axis,leaves[i]->volume.Center()-org)<0)
251 #if DBVT_MERGE_IMPL==DBVT_IMPL_SSE
254 volume=leaves[0]->volume;
258 for(
int i=1,ni=leaves.
size();i<ni;++i)
260 Merge(volume,leaves[i]->volume,volume);
269 while(leaves.
size()>1)
272 int minidx[2]={-1,-1};
273 for(
int i=0;i<leaves.
size();++i)
275 for(
int j=i+1;j<leaves.
size();++j)
286 btDbvtNode* n[] = {leaves[minidx[0]],leaves[minidx[1]]};
292 leaves[minidx[0]] = p;
293 leaves.
swap(minidx[1],leaves.
size()-1);
308 if(leaves.
size()>bu_treshold)
314 int bestmidp=leaves.
size();
315 int splitcount[3][2]={{0,0},{0,0},{0,0}};
317 for( i=0;i<leaves.
size();++i)
319 const btVector3 x=leaves[i]->volume.Center()-org;
322 ++splitcount[j][
btDot(x,axis[j])>0?1:0];
327 if((splitcount[i][0]>0)&&(splitcount[i][1]>0))
329 const int midp=(int)
btFabs(
btScalar(splitcount[i][0]-splitcount[i][1]));
339 sets[0].
reserve(splitcount[bestaxis][0]);
340 sets[1].
reserve(splitcount[bestaxis][1]);
341 split(leaves,sets[0],sets[1],org,axis[bestaxis]);
347 for(
int i=0,ni=leaves.
size();i<ni;++i)
399 while(n&&(count--)) n=n->
parent;
474 bit=(bit+1)&(
sizeof(
unsigned)*8-1);
499 for(
int i=0;(i<lookahead)&&root->
parent;++i)
597 const int i=stack.
size()-1;
614 }
while(stack.
size()>0);
650 #if DBVT_ENABLE_BENCHMARK
654 #include "LinearMath/btQuickProf.h"
691 struct btDbvtBenchmark
695 NilPolicy() : m_pcount(0),m_depth(-
SIMD_INFINITY),m_checksort(true) {}
697 void Process(
const btDbvtNode*) { ++m_pcount; }
702 {
if(depth>=m_depth) m_depth=depth;
else printf(
"wrong depth: %f (should be >= %f)\r\n",depth,m_depth); }
721 static int sortfnc(
const Node& a,
const Node& b)
723 if(a.depth<b.depth)
return(+1);
724 if(a.depth>b.depth)
return(-1);
742 static int sortfnc(
const Node& a,
const Node& b)
744 if(a.depth<b.depth)
return(+1);
745 if(a.depth>b.depth)
return(-1);
757 return(
btVector3(RandUnit(),RandUnit(),RandUnit()));
761 return(RandVector3()*cs-
btVector3(cs,cs,cs)/2);
777 for(
int i=0;i<leaves;++i)
779 dbvt.
insert(RandVolume(cs,eb,es),0);
786 static const btScalar cfgVolumeCenterScale = 100;
787 static const btScalar cfgVolumeExentsBase = 1;
788 static const btScalar cfgVolumeExentsScale = 4;
789 static const int cfgLeaves = 8192;
790 static const bool cfgEnable =
true;
793 bool cfgBenchmark1_Enable = cfgEnable;
794 static const int cfgBenchmark1_Iterations = 8;
795 static const int cfgBenchmark1_Reference = 3499;
797 bool cfgBenchmark2_Enable = cfgEnable;
798 static const int cfgBenchmark2_Iterations = 4;
799 static const int cfgBenchmark2_Reference = 1945;
801 bool cfgBenchmark3_Enable = cfgEnable;
802 static const int cfgBenchmark3_Iterations = 512;
803 static const int cfgBenchmark3_Reference = 5485;
805 bool cfgBenchmark4_Enable = cfgEnable;
806 static const int cfgBenchmark4_Iterations = 512;
807 static const int cfgBenchmark4_Reference = 2814;
809 bool cfgBenchmark5_Enable = cfgEnable;
810 static const int cfgBenchmark5_Iterations = 512;
811 static const btScalar cfgBenchmark5_OffsetScale = 2;
812 static const int cfgBenchmark5_Reference = 7379;
814 bool cfgBenchmark6_Enable = cfgEnable;
815 static const int cfgBenchmark6_Iterations = 512;
816 static const btScalar cfgBenchmark6_OffsetScale = 2;
817 static const int cfgBenchmark6_Reference = 7270;
819 bool cfgBenchmark7_Enable = cfgEnable;
820 static const int cfgBenchmark7_Passes = 32;
821 static const int cfgBenchmark7_Iterations = 65536;
822 static const int cfgBenchmark7_Reference = 6307;
824 bool cfgBenchmark8_Enable = cfgEnable;
825 static const int cfgBenchmark8_Passes = 32;
826 static const int cfgBenchmark8_Iterations = 65536;
827 static const int cfgBenchmark8_Reference = 2105;
829 bool cfgBenchmark9_Enable = cfgEnable;
830 static const int cfgBenchmark9_Passes = 32;
831 static const int cfgBenchmark9_Iterations = 65536;
832 static const int cfgBenchmark9_Reference = 1879;
834 bool cfgBenchmark10_Enable = cfgEnable;
835 static const btScalar cfgBenchmark10_Scale = cfgVolumeCenterScale/10000;
836 static const int cfgBenchmark10_Passes = 32;
837 static const int cfgBenchmark10_Iterations = 65536;
838 static const int cfgBenchmark10_Reference = 1244;
840 bool cfgBenchmark11_Enable = cfgEnable;
841 static const int cfgBenchmark11_Passes = 64;
842 static const int cfgBenchmark11_Iterations = 65536;
843 static const int cfgBenchmark11_Reference = 2510;
845 bool cfgBenchmark12_Enable = cfgEnable;
846 static const int cfgBenchmark12_Iterations = 32;
847 static const int cfgBenchmark12_Reference = 3677;
849 bool cfgBenchmark13_Enable = cfgEnable;
850 static const int cfgBenchmark13_Iterations = 1024;
851 static const int cfgBenchmark13_Reference = 2231;
853 bool cfgBenchmark14_Enable = cfgEnable;
854 static const int cfgBenchmark14_Iterations = 8192;
855 static const int cfgBenchmark14_Reference = 3500;
857 bool cfgBenchmark15_Enable = cfgEnable;
858 static const int cfgBenchmark15_Iterations = 8192;
859 static const int cfgBenchmark15_Reference = 1151;
861 bool cfgBenchmark16_Enable = cfgEnable;
862 static const int cfgBenchmark16_BatchCount = 256;
863 static const int cfgBenchmark16_Passes = 16384;
864 static const int cfgBenchmark16_Reference = 5138;
866 bool cfgBenchmark17_Enable = cfgEnable;
867 static const int cfgBenchmark17_Iterations = 4;
868 static const int cfgBenchmark17_Reference = 3390;
871 printf(
"Benchmarking dbvt...\r\n");
872 printf(
"\tWorld scale: %f\r\n",cfgVolumeCenterScale);
873 printf(
"\tExtents base: %f\r\n",cfgVolumeExentsBase);
874 printf(
"\tExtents range: %f\r\n",cfgVolumeExentsScale);
875 printf(
"\tLeaves: %u\r\n",cfgLeaves);
876 printf(
"\tsizeof(btDbvtVolume): %u bytes\r\n",
sizeof(
btDbvtVolume));
877 printf(
"\tsizeof(btDbvtNode): %u bytes\r\n",
sizeof(
btDbvtNode));
878 if(cfgBenchmark1_Enable)
883 volumes.
resize(cfgLeaves);
884 results.
resize(cfgLeaves);
885 for(
int i=0;i<cfgLeaves;++i)
887 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
889 printf(
"[1] btDbvtVolume intersections: ");
891 for(
int i=0;i<cfgBenchmark1_Iterations;++i)
893 for(
int j=0;j<cfgLeaves;++j)
895 for(
int k=0;k<cfgLeaves;++k)
897 results[k]=
Intersect(volumes[j],volumes[k]);
902 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark1_Reference)*100/time);
904 if(cfgBenchmark2_Enable)
909 volumes.
resize(cfgLeaves);
910 results.
resize(cfgLeaves);
911 for(
int i=0;i<cfgLeaves;++i)
913 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
915 printf(
"[2] btDbvtVolume merges: ");
917 for(
int i=0;i<cfgBenchmark2_Iterations;++i)
919 for(
int j=0;j<cfgLeaves;++j)
921 for(
int k=0;k<cfgLeaves;++k)
923 Merge(volumes[j],volumes[k],results[k]);
928 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark2_Reference)*100/time);
930 if(cfgBenchmark3_Enable)
934 btDbvtBenchmark::NilPolicy policy;
935 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[0]);
936 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[1]);
939 printf(
"[3] btDbvt::collideTT: ");
941 for(
int i=0;i<cfgBenchmark3_Iterations;++i)
946 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark3_Reference)*100/time);
948 if(cfgBenchmark4_Enable)
952 btDbvtBenchmark::NilPolicy policy;
953 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
955 printf(
"[4] btDbvt::collideTT self: ");
957 for(
int i=0;i<cfgBenchmark4_Iterations;++i)
962 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark4_Reference)*100/time);
964 if(cfgBenchmark5_Enable)
969 btDbvtBenchmark::NilPolicy policy;
970 transforms.
resize(cfgBenchmark5_Iterations);
971 for(
int i=0;i<transforms.
size();++i)
973 transforms[i]=btDbvtBenchmark::RandTransform(cfgVolumeCenterScale*cfgBenchmark5_OffsetScale);
975 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[0]);
976 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt[1]);
979 printf(
"[5] btDbvt::collideTT xform: ");
981 for(
int i=0;i<cfgBenchmark5_Iterations;++i)
986 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark5_Reference)*100/time);
988 if(cfgBenchmark6_Enable)
993 btDbvtBenchmark::NilPolicy policy;
994 transforms.
resize(cfgBenchmark6_Iterations);
995 for(
int i=0;i<transforms.
size();++i)
997 transforms[i]=btDbvtBenchmark::RandTransform(cfgVolumeCenterScale*cfgBenchmark6_OffsetScale);
999 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1001 printf(
"[6] btDbvt::collideTT xform,self: ");
1003 for(
int i=0;i<cfgBenchmark6_Iterations;++i)
1008 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark6_Reference)*100/time);
1010 if(cfgBenchmark7_Enable)
1016 btDbvtBenchmark::NilPolicy policy;
1017 rayorg.
resize(cfgBenchmark7_Iterations);
1018 raydir.
resize(cfgBenchmark7_Iterations);
1019 for(
int i=0;i<rayorg.
size();++i)
1021 rayorg[i]=btDbvtBenchmark::RandVector3(cfgVolumeCenterScale*2);
1022 raydir[i]=btDbvtBenchmark::RandVector3(cfgVolumeCenterScale*2);
1024 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1026 printf(
"[7] btDbvt::rayTest: ");
1028 for(
int i=0;i<cfgBenchmark7_Passes;++i)
1030 for(
int j=0;j<cfgBenchmark7_Iterations;++j)
1036 unsigned rays=cfgBenchmark7_Passes*cfgBenchmark7_Iterations;
1037 printf(
"%u ms (%i%%),(%u r/s)\r\n",time,(time-cfgBenchmark7_Reference)*100/time,(rays*1000)/time);
1039 if(cfgBenchmark8_Enable)
1043 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1045 printf(
"[8] insert/remove: ");
1047 for(
int i=0;i<cfgBenchmark8_Passes;++i)
1049 for(
int j=0;j<cfgBenchmark8_Iterations;++j)
1051 dbvt.
remove(dbvt.
insert(btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale),0));
1055 const int ir=cfgBenchmark8_Passes*cfgBenchmark8_Iterations;
1056 printf(
"%u ms (%i%%),(%u ir/s)\r\n",time,(time-cfgBenchmark8_Reference)*100/time,ir*1000/time);
1058 if(cfgBenchmark9_Enable)
1063 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1066 printf(
"[9] updates (teleport): ");
1068 for(
int i=0;i<cfgBenchmark9_Passes;++i)
1070 for(
int j=0;j<cfgBenchmark9_Iterations;++j)
1072 dbvt.
update(const_cast<btDbvtNode*>(leaves[rand()%cfgLeaves]),
1073 btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale));
1077 const int up=cfgBenchmark9_Passes*cfgBenchmark9_Iterations;
1078 printf(
"%u ms (%i%%),(%u u/s)\r\n",time,(time-cfgBenchmark9_Reference)*100/time,up*1000/time);
1080 if(cfgBenchmark10_Enable)
1086 vectors.
resize(cfgBenchmark10_Iterations);
1087 for(
int i=0;i<vectors.
size();++i)
1089 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1))*cfgBenchmark10_Scale;
1091 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1094 printf(
"[10] updates (jitter): ");
1097 for(
int i=0;i<cfgBenchmark10_Passes;++i)
1099 for(
int j=0;j<cfgBenchmark10_Iterations;++j)
1108 const int up=cfgBenchmark10_Passes*cfgBenchmark10_Iterations;
1109 printf(
"%u ms (%i%%),(%u u/s)\r\n",time,(time-cfgBenchmark10_Reference)*100/time,up*1000/time);
1111 if(cfgBenchmark11_Enable)
1115 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1117 printf(
"[11] optimize (incremental): ");
1119 for(
int i=0;i<cfgBenchmark11_Passes;++i)
1124 const int op=cfgBenchmark11_Passes*cfgBenchmark11_Iterations;
1125 printf(
"%u ms (%i%%),(%u o/s)\r\n",time,(time-cfgBenchmark11_Reference)*100/time,op/time*1000);
1127 if(cfgBenchmark12_Enable)
1132 volumes.
resize(cfgLeaves);
1133 results.
resize(cfgLeaves);
1134 for(
int i=0;i<cfgLeaves;++i)
1136 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
1138 printf(
"[12] btDbvtVolume notequal: ");
1140 for(
int i=0;i<cfgBenchmark12_Iterations;++i)
1142 for(
int j=0;j<cfgLeaves;++j)
1144 for(
int k=0;k<cfgLeaves;++k)
1146 results[k]=
NotEqual(volumes[j],volumes[k]);
1151 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark12_Reference)*100/time);
1153 if(cfgBenchmark13_Enable)
1158 btDbvtBenchmark::NilPolicy policy;
1159 vectors.
resize(cfgBenchmark13_Iterations);
1160 for(
int i=0;i<vectors.
size();++i)
1162 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1164 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1166 printf(
"[13] culling(OCL+fullsort): ");
1168 for(
int i=0;i<cfgBenchmark13_Iterations;++i)
1175 const int t=cfgBenchmark13_Iterations;
1176 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark13_Reference)*100/time,(t*1000)/time);
1178 if(cfgBenchmark14_Enable)
1183 btDbvtBenchmark::P14 policy;
1184 vectors.
resize(cfgBenchmark14_Iterations);
1185 for(
int i=0;i<vectors.
size();++i)
1187 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1189 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1191 policy.m_nodes.reserve(cfgLeaves);
1192 printf(
"[14] culling(OCL+qsort): ");
1194 for(
int i=0;i<cfgBenchmark14_Iterations;++i)
1197 policy.m_nodes.resize(0);
1198 dbvt.
collideOCL(dbvt.
m_root,&vectors[i],&offset,vectors[i],1,policy,
false);
1199 policy.m_nodes.quickSort(btDbvtBenchmark::P14::sortfnc);
1202 const int t=cfgBenchmark14_Iterations;
1203 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark14_Reference)*100/time,(t*1000)/time);
1205 if(cfgBenchmark15_Enable)
1210 btDbvtBenchmark::P15 policy;
1211 vectors.
resize(cfgBenchmark15_Iterations);
1212 for(
int i=0;i<vectors.
size();++i)
1214 vectors[i]=(btDbvtBenchmark::RandVector3()*2-
btVector3(1,1,1)).normalized();
1216 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1218 policy.m_nodes.reserve(cfgLeaves);
1219 printf(
"[15] culling(KDOP+qsort): ");
1221 for(
int i=0;i<cfgBenchmark15_Iterations;++i)
1224 policy.m_nodes.resize(0);
1225 policy.m_axis=vectors[i];
1227 policy.m_nodes.quickSort(btDbvtBenchmark::P15::sortfnc);
1230 const int t=cfgBenchmark15_Iterations;
1231 printf(
"%u ms (%i%%),(%u t/s)\r\n",time,(time-cfgBenchmark15_Reference)*100/time,(t*1000)/time);
1233 if(cfgBenchmark16_Enable)
1238 btDbvtBenchmark::RandTree(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale,cfgLeaves,dbvt);
1240 batch.
reserve(cfgBenchmark16_BatchCount);
1241 printf(
"[16] insert/remove batch(%u): ",cfgBenchmark16_BatchCount);
1243 for(
int i=0;i<cfgBenchmark16_Passes;++i)
1245 for(
int j=0;j<cfgBenchmark16_BatchCount;++j)
1247 batch.
push_back(dbvt.
insert(btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale),0));
1249 for(
int j=0;j<cfgBenchmark16_BatchCount;++j)
1256 const int ir=cfgBenchmark16_Passes*cfgBenchmark16_BatchCount;
1257 printf(
"%u ms (%i%%),(%u bir/s)\r\n",time,(time-cfgBenchmark16_Reference)*100/time,
int(ir*1000.0/time));
1259 if(cfgBenchmark17_Enable)
1265 volumes.
resize(cfgLeaves);
1266 results.
resize(cfgLeaves);
1267 indices.
resize(cfgLeaves);
1268 for(
int i=0;i<cfgLeaves;++i)
1271 volumes[i]=btDbvtBenchmark::RandVolume(cfgVolumeCenterScale,cfgVolumeExentsBase,cfgVolumeExentsScale);
1273 for(
int i=0;i<cfgLeaves;++i)
1275 btSwap(indices[i],indices[rand()%cfgLeaves]);
1277 printf(
"[17] btDbvtVolume select: ");
1279 for(
int i=0;i<cfgBenchmark17_Iterations;++i)
1281 for(
int j=0;j<cfgLeaves;++j)
1283 for(
int k=0;k<cfgLeaves;++k)
1285 const int idx=indices[k];
1286 results[idx]=
Select(volumes[idx],volumes[j],volumes[k]);
1291 printf(
"%u ms (%i%%)\r\n",time,(time-cfgBenchmark17_Reference)*100/time);
static DBVT_PREFIX void collideKDOP(const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, int count, DBVT_IPOLICY)
DBVT_INLINE void Merge(const btDbvtAabbMm &a, const btDbvtAabbMm &b, btDbvtAabbMm &r)
void push_back(const T &_Val)
static void bottomup(btDbvt *pdbvt, tNodeArray &leaves)
DBVT_INLINE bool isleaf() const
static DBVT_PREFIX void collideOCL(const btDbvtNode *root, const btVector3 *normals, const btScalar *offsets, const btVector3 &sortaxis, int count, DBVT_IPOLICY, bool fullsort=true)
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
static void fetchleaves(btDbvt *pdbvt, btDbvtNode *root, tNodeArray &leaves, int depth=-1)
static void getmaxdepth(const btDbvtNode *node, int depth, int &maxdepth)
static void recursedeletenode(btDbvt *pdbvt, btDbvtNode *node)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes ...
btDbvtNode * insert(const btDbvtVolume &box, void *data)
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling...
virtual void WriteNode(const btDbvtNode *, int index, int parent, int child0, int child1)=0
void reset()
Resets the initial reference time.
static DBVT_PREFIX void rayTest(const btDbvtNode *root, const btVector3 &rayFrom, const btVector3 &rayTo, DBVT_IPOLICY)
rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thre...
DBVT_INLINE int Select(const btDbvtAabbMm &o, const btDbvtAabbMm &a, const btDbvtAabbMm &b)
DBVT_INLINE bool isinternal() const
void swap(int index0, int index1)
void Process(const btDbvtNode *n)
const btScalar & x() const
Return the x value.
unsigned long int getTimeMilliseconds()
Returns the time in ms since the last call to reset or since the btClock was created.
void update(btDbvtNode *leaf, int lookahead=-1)
btAlignedObjectArray< const btDbvtNode * > tConstNodeArray
static int countLeaves(const btDbvtNode *node)
int size() const
return the number of elements in the array
void optimizeIncremental(int passes)
static DBVT_INLINE btDbvtNode * createnode(btDbvt *pdbvt, btDbvtNode *parent, void *data)
static btDbvtAabbMm FromCE(const btVector3 &c, const btVector3 &e)
static DBVT_INLINE btDbvtVolume merge(const btDbvtVolume &a, const btDbvtVolume &b)
static int maxdepth(const btDbvtNode *node)
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
DBVT_INLINE btVector3 Lengths() const
static void insertleaf(btDbvt *pdbvt, btDbvtNode *root, btDbvtNode *leaf)
#define btAlignedFree(ptr)
DBVT_INLINE btVector3 Center() const
DBVT_INLINE void Expand(const btVector3 &e)
btAlignedObjectArray< sStkNN > m_stkStack
void optimizeTopDown(int bu_treshold=128)
const btScalar & y() const
Return the y value.
btVector3 can be used to represent 3D points and vectors.
#define ATTRIBUTE_ALIGNED16(a)
DBVT_INLINE const btVector3 & Maxs() const
void write(IWriter *iwriter) const
virtual void Prepare(const btDbvtNode *root, int numnodes)=0
static void split(const tNodeArray &leaves, tNodeArray &left, tNodeArray &right, const btVector3 &org, const btVector3 &axis)
void resize(int newsize, const T &fillData=T())
int findLinearSearch(const T &key) const
virtual void WriteLeaf(const btDbvtNode *, int index, int parent)=0
static btDbvtNode * removeleaf(btDbvt *pdbvt, btDbvtNode *leaf)
const T & btMax(const T &a, const T &b)
static void extractLeaves(const btDbvtNode *node, btAlignedObjectArray< const btDbvtNode * > &leaves)
DBVT_INLINE bool Intersect(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
static btDbvtNode * topdown(btDbvt *pdbvt, tNodeArray &leaves, int bu_treshold)
#define btAlignedAlloc(size, alignment)
static DBVT_INLINE int indexof(const btDbvtNode *node)
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btAlignedObjectArray< btDbvtNode * > tNodeArray
btDbvt implementation by Nathanael Presson
DBVT_PREFIX void collideTT(const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
static DBVT_INLINE void deletenode(btDbvt *pdbvt, btDbvtNode *node)
DBVT_INLINE bool Contain(const btDbvtAabbMm &a) const
static DBVT_PREFIX void enumNodes(const btDbvtNode *root, DBVT_IPOLICY)
DBVT_INLINE const btVector3 & Mins() const
DBVT_INLINE void SignedExpand(const btVector3 &e)
static DBVT_INLINE btDbvtNode * sort(btDbvtNode *n, btDbvtNode *&r)
void clone(btDbvt &dest, IClone *iclone=0) const
void remove(btDbvtNode *leaf)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual void CloneLeaf(btDbvtNode *)
static btDbvtVolume bounds(const tNodeArray &leaves)
DBVT_INLINE bool NotEqual(const btDbvtAabbMm &a, const btDbvtAabbMm &b)
btScalar btFabs(btScalar x)
const btScalar & z() const
Return the z value.