Changeset 296 for trunk/VUT


Ignore:
Timestamp:
09/21/05 10:30:44 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r295 r296  
    1818int BspTree::sSplitPlaneStrategy = NEXT_POLYGON;  
    1919int BspTree::sConstructionMethod = VIEW_CELLS; 
     20float BspTree::sLeastSplitsFactor = 1.0f 
     21float BspTree::sBalancedTreeFactor = 2.0f; 
     22float BspTree::sVerticalFactor = 50.0f // very important criterium for 2.5d scenes 
     23 
    2024 
    2125/** Evaluates split plane classification with respect to the plane's  
     
    688692        } 
    689693 
    690         /*if (sSplitPlaneStrategy & DRIVING_AXIS) 
     694        /*if (sSplitPlaneStrategy & VERTICAL_AXIS) 
    691695        { 
    692696                const float dot_thres = 0.999; 
     
    737741float BspTree::EvalSplitPlane(const PolygonContainer &polys, const Plane3 &candidatePlane) const 
    738742{ 
    739         float sumBalanced = 0, sumLeastSplits, drivingAxis = 0; 
    740          
    741         if (sSplitPlaneStrategy & DRIVING_AXIS) 
    742         { 
    743         drivingAxis = (candidatePlane.mNormal.DrivingAxis() == mBox.Size().DrivingAxis()) ? 
    744                         99.0f : 0.0f; // always prefer driving axis => very high value 
     743        float sumBalanced = 0, sumLeastSplits = 0, verticalAxis = 0; 
     744         
     745        if (sSplitPlaneStrategy & VERTICAL_AXIS) 
     746        { 
     747                Vector3 thinAxis(0,0,0); thinAxis[mBox.size().ThinAxis()] = 1.0f; 
     748                // want to minimize this dot product 
     749                verticalAxis = DotProd(candidatePlane.mNormal, thinAxis); 
     750                 
     751        //drivingAxis = (candidatePlane.mNormal.DrivingAxis() == mBox.Size().DrivingAxis()) ? 99.0f : 0.0f; 
    745752        } 
    746753        if ((sSplitPlaneStrategy & BALANCED_TREE) || (sSplitPlaneStrategy & LEAST_SPLITS)) 
     
    761768 
    762769        // return linear combination of the sums 
    763         return fabs(sumBalanced) + sumLeastSplits + drivingAxis; 
     770        return sBalancedFactor * fabs(sumBalanced) + sLeastSplitsFactor * sumLeastSplits + sVerticalFactor * dotProd; 
    764771} 
    765772 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r295 r296  
    439439                  LEAST_SPLITS = 2,  
    440440                  BALANCED_TREE = 4,  
    441                   DRIVING_AXIS = 8,  
     441                  VERTICAL_AXIS = 8,  
    442442                  AXIS_ALIGNED = 16}; 
    443443 
     
    466466        static int sConstructionMethod; 
    467467 
     468        static float sLeastSplitsFactor; 
     469        static float sBalancedTreeFactor; 
     470        static float sVerticalFactor; 
     471 
    468472private: 
    469473        /** Evaluates split plane classification with respect to the plane's  
Note: See TracChangeset for help on using the changeset viewer.