Changeset 545


Ignore:
Timestamp:
01/17/06 00:28:06 (18 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r544 r545  
    3030        samplesPerPass  100000 
    3131        initialSamples 300000 
    32         vssSamples 1000000 
     32        vssSamples 1200000 
    3333        vssSamplesPerPass 100000 
    3434        useImportanceSampling true 
     
    259259VspBspTree { 
    260260        Construction { 
    261                 samples 600000 
     261                samples 100000 
    262262                epsilon 0.005 
    263263                randomize false 
     
    298298                #minArea                0.0001 
    299299                minArea                 -1 
    300                 maxRayContribution      0.2 
     300                maxRayContribution      0.3 
    301301                maxCostRatio            0.9 
    302302                missTolerance           3 
    303303                #maxAccRayLength        100 
    304304                 
    305                 maxViewCells            6001 
     305                maxViewCells            501 
    306306                 
    307307                # used for pvs criterium 
  • trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.cpp

    r542 r545  
    20382038        polys.push_back(face1);    
    20392039 
    2040     face1->mVertices.push_back(Vector3(mMin.x,mMin.y,mMax.z)); 
    2041         face1->mVertices.push_back(Vector3(mMin.x,mMax.y,mMax.z)); 
    2042         face1->mVertices.push_back(Vector3(mMin.x,mMax.y,mMin.z)); 
    2043         face1->mVertices.push_back(Vector3(mMin.x,mMin.y,mMin.z)); 
     2040    face1->mVertices.push_back(Vector3(mMin.x, mMin.y, mMax.z)); 
     2041        face1->mVertices.push_back(Vector3(mMin.x, mMax.y, mMax.z)); 
     2042        face1->mVertices.push_back(Vector3(mMin.x, mMax.y ,mMin.z)); 
     2043        face1->mVertices.push_back(Vector3(mMin.x, mMin.y, mMin.z)); 
    20442044 
    20452045        Polygon3 *face2 = new Polygon3();   
    20462046        polys.push_back(face2); 
    2047  
    2048     face2->mVertices.push_back(Vector3(mMax.x,mMin.y,mMin.z)); 
    2049     face2->mVertices.push_back(Vector3(mMax.x,mMax.y,mMin.z)); 
    2050     face2->mVertices.push_back(Vector3(mMax.x,mMax.y,mMax.z)); 
    2051     face2->mVertices.push_back(Vector3(mMax.x,mMin.y,mMax.z)); 
     2047     
     2048    face2->mVertices.push_back(Vector3(mMax.x, mMin.y, mMin.z)); 
     2049    face2->mVertices.push_back(Vector3(mMax.x, mMax.y, mMin.z)); 
     2050    face2->mVertices.push_back(Vector3(mMax.x, mMax.y, mMax.z)); 
     2051    face2->mVertices.push_back(Vector3(mMax.x, mMin.y, mMax.z)); 
    20522052   
    20532053        Polygon3 *face3 = new Polygon3();   
    20542054        polys.push_back(face3); 
    20552055 
    2056     face3->mVertices.push_back(Vector3(mMax.x,mMin.y,mMin.z)); 
    2057         face3->mVertices.push_back(Vector3(mMax.x,mMin.y,mMax.z)); 
    2058         face3->mVertices.push_back(Vector3(mMin.x,mMin.y,mMax.z)); 
    2059         face3->mVertices.push_back(Vector3(mMin.x,mMin.y,mMin.z)); 
     2056    face3->mVertices.push_back(Vector3(mMax.x, mMin.y ,mMin.z)); 
     2057        face3->mVertices.push_back(Vector3(mMax.x, mMin.y, mMax.z)); 
     2058        face3->mVertices.push_back(Vector3(mMin.x, mMin.y, mMax.z)); 
     2059        face3->mVertices.push_back(Vector3(mMin.x, mMin.y, mMin.z)); 
    20602060 
    20612061        Polygon3 *face4 = new Polygon3();   
    20622062        polys.push_back(face4); 
    20632063 
    2064         face4->mVertices.push_back(Vector3(mMin.x,mMax.y,mMin.z)); 
    2065         face4->mVertices.push_back(Vector3(mMin.x,mMax.y,mMax.z)); 
    2066         face4->mVertices.push_back(Vector3(mMax.x,mMax.y,mMax.z)); 
    2067         face4->mVertices.push_back(Vector3(mMax.x,mMax.y,mMin.z)); 
     2064        face4->mVertices.push_back(Vector3(mMin.x, mMax.y, mMin.z)); 
     2065        face4->mVertices.push_back(Vector3(mMin.x, mMax.y, mMax.z)); 
     2066        face4->mVertices.push_back(Vector3(mMax.x, mMax.y, mMax.z)); 
     2067        face4->mVertices.push_back(Vector3(mMax.x, mMax.y, mMin.z)); 
    20682068     
    20692069        Polygon3 *face5 = new Polygon3();   
    20702070        polys.push_back(face5); 
    20712071 
    2072         face5->mVertices.push_back(Vector3(mMin.x,mMax.y,mMin.z)); 
    2073     face5->mVertices.push_back(Vector3(mMax.x,mMax.y,mMin.z)); 
    2074     face5->mVertices.push_back(Vector3(mMax.x,mMin.y,mMin.z)); 
    2075         face5->mVertices.push_back(Vector3(mMin.x,mMin.y,mMin.z)); 
     2072        face5->mVertices.push_back(Vector3(mMin.x, mMax.y, mMin.z)); 
     2073    face5->mVertices.push_back(Vector3(mMax.x, mMax.y, mMin.z)); 
     2074    face5->mVertices.push_back(Vector3(mMax.x, mMin.y, mMin.z)); 
     2075        face5->mVertices.push_back(Vector3(mMin.x, mMin.y, mMin.z)); 
    20762076 
    20772077        Polygon3 *face6 = new Polygon3();   
    20782078        polys.push_back(face6);   
    20792079   
    2080     face6->mVertices.push_back(Vector3(mMin.x,mMin.y,mMax.z)); 
    2081     face6->mVertices.push_back(Vector3(mMax.x,mMin.y,mMax.z)); 
    2082     face6->mVertices.push_back(Vector3(mMax.x,mMax.y,mMax.z)); 
    2083     face6->mVertices.push_back(Vector3(mMin.x,mMax.y,mMax.z)); 
    2084 } 
     2080    face6->mVertices.push_back(Vector3(mMin.x, mMin.y, mMax.z)); 
     2081    face6->mVertices.push_back(Vector3(mMax.x, mMin.y, mMax.z)); 
     2082    face6->mVertices.push_back(Vector3(mMax.x, mMax.y, mMax.z)); 
     2083    face6->mVertices.push_back(Vector3(mMin.x, mMax.y, mMax.z)); 
     2084} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r544 r545  
    11671167} 
    11681168 
     1169 
    11691170Plane3 BspTree::SelectPlane(BspLeaf *leaf, BspTraversalData &data) 
    11701171{ 
     
    15531554        } 
    15541555                         
    1555         bool useRand;; 
     1556        bool useRand; 
    15561557        int limit; 
    15571558 
     
    25592560        PolygonContainer::const_iterator pit, pit_end = mPolys.end(); 
    25602561 
     2562        // note: can take arbitrary point, e.g., the origin. However, 
     2563        // center of mass prevents precision errors 
     2564        const Vector3 center = CenterOfMass(); 
     2565 
    25612566        for (pit = mPolys.begin(); pit != pit_end; ++ pit) 
    25622567        { 
    25632568                Polygon3 *poly = *pit; 
    2564                 const Vector3 v = poly->mVertices[0]; 
     2569                const Vector3 v0 = poly->mVertices[0] - center; 
    25652570 
    25662571                for (int i = 1; i < (int)poly->mVertices.size() - 1; ++ i) 
    25672572                { 
    2568                         volume += f * (DotProd(v,  
    2569                                 CrossProd(poly->mVertices[i], poly->mVertices[i + 1]))); 
    2570                 } 
    2571         } 
    2572  
    2573         Debug << "volume: " << volume << endl; 
     2573                        const Vector3 v1 = poly->mVertices[i] - center; 
     2574                        const Vector3 v2 = poly->mVertices[i + 1] - center; 
     2575 
     2576                        volume += f * (DotProd(v0, CrossProd(v1, v2))); 
     2577                } 
     2578        } 
     2579 
    25742580        return volume; 
    25752581} 
    25762582 
    25772583 
    2578 Vector3 BspNodeGeometry::ComputeMassCenter() const 
     2584Vector3 BspNodeGeometry::CenterOfMass() const 
    25792585{ 
    25802586        int n = 0; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r544 r545  
    6161        /** Computes mass center of bsp node geometry. 
    6262        */ 
    63         Vector3 ComputeMassCenter() const; 
     63        Vector3 CenterOfMass() const; 
     64 
    6465        /** The polygons the geometry consists of. 
    6566        */ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r544 r545  
    605605                                                                                   mEpsilon); 
    606606                 
    607                         frontData.mArea = frontData.mGeometry->GetArea(); 
    608                         backData.mArea = backData.mGeometry->GetArea(); 
     607                        //frontData.mArea = frontData.mGeometry->GetArea(); 
     608                        //backData.mArea = backData.mGeometry->GetArea(); 
     609                        frontData.mArea = frontData.mGeometry->GetVolume(); 
     610                        backData.mArea = backData.mGeometry->GetVolume(); 
    609611                } 
    610612        } 
     
    851853        int bestAxis = -1; 
    852854 
    853         // create bounding box of node extent 
     855        // create bounding box of node geometry 
    854856        AxisAlignedBox3 box; 
    855857        box.Initialize(); 
     
    877879                nBackGeom[axis] = new BspNodeGeometry(); 
    878880 
    879                 if (!mOnlyDrivingAxis || axis == sAxis) 
     881                if (!mOnlyDrivingAxis || (axis == sAxis)) 
    880882                { 
    881883                        if (!useCostHeuristics) 
     
    894896                                         
    895897                                        pos = box.Max(); pos[axis] = nPosition[axis]; 
    896                                         AxisAlignedBox3 backBox(box.Min(), pos); 
     898                                        const AxisAlignedBox3 backBox(box.Min(), pos); 
    897899                                        backBox.ExtractPolys(nBackGeom[axis]->mPolys); 
    898900                                         
    899901                                        pos = box.Min(); pos[axis] = nPosition[axis]; 
    900                                         AxisAlignedBox3 frontBox(pos, box.Max()); 
     902                                        const AxisAlignedBox3 frontBox(pos, box.Max()); 
    901903                                        frontBox.ExtractPolys(nFrontGeom[axis]->mPolys); 
    902904 
     
    11071109                // we can do this because we always save the 
    11081110                // computed values from the axis aligned splits 
    1109                 /*frontData.mGeometry = fGeom; 
     1111                frontData.mGeometry = fGeom; 
    11101112                backData.mGeometry = bGeom; 
    11111113                frontData.mArea = fArea; 
    11121114                backData.mArea = bArea; 
    1113 */ 
     1115 
    11141116                //! error also computed if cost ratio is missed 
    11151117                ++ mStat.splits[axis]; 
     
    13011303                                                                                  mBox, 
    13021304                                                                                  mEpsilon); 
    1303 #if 0 
    1304                         AxisAlignedBox3 fbox; 
    1305                         AxisAlignedBox3 bbox; 
    1306                         AxisAlignedBox3 box; 
    1307                         fbox.Initialize(); 
    1308                         bbox.Initialize(); 
    1309                         box.Initialize(); 
    1310  
    1311                         geomFront.IncludeInBox(fbox); 
    1312                         geomBack.IncludeInBox(bbox); 
    1313                         data.mGeometry->IncludeInBox(box); 
    1314  
    1315                         areaFront = fbox.GetVolume(); 
    1316                         areaBack = bbox.GetVolume(); 
    1317  
    1318                         pOverall = box.GetVolume(); 
    1319 #else 
    1320                         areaFront = geomFront.GetArea(); 
    1321                         areaBack = geomBack.GetArea(); 
     1305 
     1306                         
     1307                        pFront = geomFront.GetVolume(); 
     1308                        pBack = geomBack.GetVolume(); 
     1309                        //areaFront = geomFront.GetArea(); 
     1310                        //areaBack = geomBack.GetArea(); 
    13221311 
    13231312                        pOverall = data.mArea; 
    1324 #endif 
    1325                         pBack = areaBack; 
    1326                         pFront = areaFront; 
     1313 
    13271314                } 
    13281315                else // use number of rays to approximate volume 
Note: See TracChangeset for help on using the changeset viewer.