Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1196 - in trunk: Model/Groups SwigInterface


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1196 - in trunk: Model/Groups SwigInterface
  • Date: Fri, 29 Sep 2006 01:30:41 -0600 (MDT)

Author: abe
Date: Fri Sep 29 01:30:40 2006
New Revision: 1196

Modified:
   trunk/Model/Groups/Build_OnLogn_cc.cc
   trunk/SwigInterface/kdtreedyn.py
Log:

Fixed bug which caused tree size to be larger than necessary.

M    SwigInterface/kdtreedyn.py
M    Model/Groups/Build_OnLogn_cc.cc


Modified: trunk/Model/Groups/Build_OnLogn_cc.cc
==============================================================================
--- trunk/Model/Groups/Build_OnLogn_cc.cc       (original)
+++ trunk/Model/Groups/Build_OnLogn_cc.cc       Fri Sep 29 01:30:40 2006
@@ -598,7 +598,7 @@
   
/////////////////////////////////////////////////////////////////////////////
 
   vector<Frame *> build_stack;
-  build_stack.reserve( 128 );
+  build_stack.reserve( depth_threshold+1 );
   
   
/////////////////////////////////////////////////////////////////////////////
   // Add the root node to the build stack.
@@ -644,7 +644,7 @@
       // Create a Leaf.
       
///////////////////////////////////////////////////////////////////////////
       
///////////////////////////////////////////////////////////////////////////
-      if ((frame->candidates.size() < leaf_threshold) || // Condition: Leaf 
threshold.
+      if ((frame->index_list.size() < leaf_threshold) || // Condition: Leaf 
threshold.
           (frame->depth >= depth_threshold)      || // Condition: Depth 
threshold.
           (break_out)
           ) {

Modified: trunk/SwigInterface/kdtreedyn.py
==============================================================================
--- trunk/SwigInterface/kdtreedyn.py    (original)
+++ trunk/SwigInterface/kdtreedyn.py    Fri Sep 29 01:30:40 2006
@@ -14,6 +14,7 @@
 
###############################################################################
 
 # Remember to declare these are "global" when defining them.
+builder_name = "Build_OnLogn_cc"
 file_name = ""
 leaf_threshold       = 8
 depth_threshold      = 64
@@ -59,10 +60,20 @@
 
     
###########################################################################
     # Build the kdtree.
-    global leaf_threshold, depth_threshold, cost_threshold
-    builder = Build_OnLogn_cc( leaf_threshold,
-                               depth_threshold,
-                               cost_threshold )
+    global leaf_threshold, depth_threshold, cost_threshold, builder_name
+
+    # Try to find the builder class.
+    try:
+        import manta
+        builder_class = getattr(manta,builder_name);
+    except AttributeError,e:
+        print "Could not find builder class: " + builder_name
+        return scene
+        
+    # Construct the builder.
+    builder = builder_class( leaf_threshold,
+                             depth_threshold,
+                             cost_threshold )
 
     # Add the kdtree to the scene.
     world = manta_new( Group() )
@@ -106,6 +117,7 @@
     print "Where options contains one or more of:"
     print "-n --np=<threads>"
     print "-f --file=<file name>"
+    print "-b --build=<builder class> Default: " + builder_name
     print "   --depth_threshold=<n>"
     print "      Create a leaf if depth is equal to n"
     print "   --leaf_threshold=<n>"
@@ -124,9 +136,10 @@
     # So -np would be parsed as -n <space> p. Use --np=<threads> instead.
     try:
         opts, args = getopt.getopt(sys.argv[1:],
-                                   "n:f:",
+                                   "n:f:b:",
                                    ["np=",
                                     "file=",
+                                    "build=",
                                     "leaf_threshold=",
                                     "depth_threshold=",
                                     "cost_threshold=" ] )
@@ -140,7 +153,9 @@
             if o in ("-n", "--np"):
                 num_workers = int(a)
             elif o in ("-f", "--file"):
-                file_name = a;      
+                file_name = a
+            elif o in ("-b", "--builder"):
+                builder_name = a
             elif o in ("--leaf_threshold"):
                 leaf_threshold = int(a)
             elif o in ("--depth_threshold"):




  • [MANTA] r1196 - in trunk: Model/Groups SwigInterface, abe, 09/29/2006

Archive powered by MHonArc 2.6.16.

Top of page