Changeset 1047


Ignore:
Timestamp:
06/21/06 18:26:17 (18 years ago)
Author:
mattausch
Message:

fixed vsp part of vsp osp tree

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp

    r1012 r1047  
    21232123} 
    21242124 
     2125 
    21252126void AxisAlignedBox3::Split(const int axis,  
    21262127                                                        const float value,  
    2127                                                         AxisAlignedBox3 &left,  
    2128                                                         AxisAlignedBox3 &right) const 
     2128                                                        AxisAlignedBox3 &front,  
     2129                                                        AxisAlignedBox3 &back) const 
    21292130{ 
    21302131        if ( (value >= mMin[axis]) && (value <= mMax[axis]) ) 
    21312132        { 
    2132                 left.mMin = mMin; left.mMax = mMax; 
    2133                 right.mMin = mMin; right.mMax = mMax; 
    2134  
    2135                 left.mMax[axis] = value; 
    2136                 right.mMin[axis] = value; 
    2137  
     2133                front.mMin = mMin; front.mMax = mMax; 
     2134                back.mMin = mMin; back.mMax = mMax; 
     2135 
     2136                back.mMax[axis] = value; 
     2137                front.mMin[axis] = value; 
    21382138        } 
    21392139} 
    2140 } 
     2140 
     2141 
     2142} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h

    r860 r1047  
    7777   
    7878 
     79/** A definition for an axis aligned plane. 
     80*/ 
     81struct AxisAlignedPlane 
     82{ 
     83public: 
     84        AxisAlignedPlane(){} 
     85        AxisAlignedPlane(const int axis, const float position): 
     86          mAxis(axis), mPosition(position) 
     87          { 
     88          } 
     89        Plane3 GetPlane() const 
     90        { 
     91                Vector3 normal(0,0,0); normal[mAxis] = 1; 
     92                Vector3 point(0,0,0); point[mAxis] = mPosition; 
     93 
     94        return Plane3(normal, point); 
     95        } 
     96 
     97        /// the split axis: one of 0=x, 1=y, 2=z 
     98        int mAxis; 
     99        /// the absolute position of the split axis 
     100        float mPosition; 
     101}; 
     102 
     103 
    79104} 
    80105 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1027 r1047  
    17471747        Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 
    17481748 
    1749         Vector3 normal(0,0,0); 
    1750         normal[axis] = 1; 
    1751  
    1752         mClipPlane = Plane3(normal, point); 
     1749        mClipPlane = AxisAlignedPlane(axis, point[axis]); 
    17531750} 
    17541751 
     
    24282425} 
    24292426 
     2427 
     2428 
    24302429/**********************************************************************/ 
    24312430/*                 BspViewCellsManager implementation                 */ 
     
    29272926void BspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    29282927                                                                                                 ViewCell *vc, 
    2929                                                                                                  const Plane3 *clipPlane) const 
     2928                                                                                                 const AxisAlignedPlane *clipPlane) const 
    29302929{ 
    29312930        // export mesh if available 
     
    29382937        if (clipPlane) 
    29392938        { 
     2939                const Plane3 plane = clipPlane->GetPlane(); 
     2940 
    29402941                ViewCellContainer leaves; 
    29412942                mViewCellsTree->CollectLeaves(vc, leaves); 
     
    29532954 
    29542955                        const float eps = 0.00000001f; 
    2955                         const int cf = geom.Side(*clipPlane, eps); 
     2956                        const int cf = geom.Side(plane, eps); 
    29562957 
    29572958                        if (cf == -1) 
     
    29632964                                geom.SplitGeometry(front, 
    29642965                                                                   back, 
    2965                                                                    *clipPlane, 
     2966                                                                   plane, 
    29662967                                                                   mViewSpaceBox,  
    29672968                                                                   eps); 
     
    30673068 
    30683069 
    3069 bool BspViewCellsManager::ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects) 
     3070bool BspViewCellsManager::ExportViewCells(const string filename,  
     3071                                                                                  const bool exportPvs,  
     3072                                                                                  const ObjectContainer &objects) 
    30703073{ 
    30713074#if STILL_HAS_TODO 
     
    34723475void KdViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    34733476                                                                                                ViewCell *vc, 
    3474                                                                                                 const Plane3 *clipPlane) const 
     3477                                                                                                const AxisAlignedPlane *clipPlane) const 
    34753478{ 
    34763479        ViewCellContainer leaves; 
     
    41544157        //-- export view cells 
    41554158        if (1)  
    4156         {       // hack pvs 
     4159        {        
     4160                // hack pvs 
    41574161                const int savedColorCode = mColorCode; 
    41584162                mColorCode = 1; 
     
    41784182 
    41794183                        // export rays 
    4180                         if (1 && mExportRays) 
     4184                        if (0 && mExportRays) 
    41814185                        { 
    41824186                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    43594363                { 
    43604364                        // output rays stored with the view cells during subdivision 
    4361                         if (0) 
     4365                        if (1) 
    43624366                        { 
    43634367                                VssRayContainer vcRays; 
     
    43944398                                } 
    43954399 
     4400                                Debug << "here233 " << (int)vcRays.size() << endl; 
     4401 
    43964402                                //-- export rays piercing this view cell 
    43974403                                exporter->ExportRays(vcRays, RgbColor(1, 1, 1)); 
     
    43994405                 
    44004406                        // associate new rays with output view cell 
    4401                         if (1) 
     4407                        if (0) 
    44024408                        { 
    44034409                                VssRayContainer vcRays; 
     
    45804586void VspBspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    45814587                                                    ViewCell *vc, 
    4582                                                                                                         const Plane3 *clipPlane) const 
     4588                                                                                                        const AxisAlignedPlane *clipPlane) const 
    45834589{ 
    45844590        if (clipPlane) 
    45854591        { 
     4592                const Plane3 plane = clipPlane->GetPlane(); 
     4593 
    45864594                ViewCellContainer leaves; 
    45874595                mViewCellsTree->CollectLeaves(vc, leaves); 
     
    45994607 
    46004608                        const float eps = 0.00000001f; 
    4601                         const int cf = geom.Side(*clipPlane, eps); 
     4609                        const int cf = geom.Side(plane, eps); 
    46024610 
    46034611                        if (cf == -1) 
     
    46094617                                geom.SplitGeometry(front, 
    46104618                                                                   back, 
    4611                                                                    *clipPlane, 
     4619                                                                   plane, 
    46124620                                                                   mViewSpaceBox,  
    46134621                                                                   eps); 
     
    47804788 
    47814789/**************************************************************************/ 
    4782 /*                   VspBspViewCellsManager implementation                */ 
     4790/*                   VspOspViewCellsManager implementation                */ 
    47834791/**************************************************************************/ 
    47844792 
     
    51365144        { 
    51375145                viewPoint = mViewSpaceBox.GetRandomPoint(); 
     5146 
    51385147                if (mVspTree->ViewPointValid(viewPoint)) 
    51395148                { 
     
    51495158void VspOspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 
    51505159                                                                                                        ViewCell *vc, 
    5151                                                                                                         const Plane3 *clipPlane) const 
     5160                                                                                                        const AxisAlignedPlane *clipPlane) const 
    51525161{ 
    51535162        ViewCellContainer leaves; 
     
    51565165        ViewCellContainer::const_iterator it, it_end = leaves.end(); 
    51575166 
     5167        Plane3 plane; 
     5168         
     5169        if (clipPlane) 
     5170                plane = clipPlane->GetPlane(); 
     5171 
    51585172        for (it = leaves.begin(); it != it_end; ++ it) 
    51595173        { 
     
    51625176 
    51635177                const AxisAlignedBox3 box = mVspTree->GetBBox(vspVc->mLeaf); 
    5164  
    5165                 if (!clipPlane || !box.Side(*clipPlane)) 
     5178                 
     5179                if (clipPlane) 
     5180                { 
     5181                        if (box.Side(plane) == -1) 
     5182                                exporter->ExportBox(box); 
     5183                        else if (box.Side(plane) == 0) 
     5184                        { 
     5185                                AxisAlignedBox3 fbox, bbox; 
     5186 
     5187                                box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 
     5188 
     5189                                exporter->ExportBox(bbox); 
     5190                        } 
     5191                } 
     5192                else 
     5193                { 
    51665194                        exporter->ExportBox(box); 
     5195                } 
    51675196        } 
    51685197} 
     
    51915220        //-- export view cells 
    51925221        if (1)  
    5193         {       // hack pvs 
     5222        {        
     5223                // hack pvs 
    51945224                const int savedColorCode = mColorCode; 
    5195                 mColorCode = 1; 
     5225                mColorCode = 0; 
    51965226         
    51975227                Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 
     
    52155245 
    52165246                        // export rays 
    5217                         if (1 && mExportRays) 
     5247                        if (0 && mExportRays) 
    52185248                        { 
    52195249                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    52925322                { 
    52935323                        // output rays stored with the view cells during subdivision 
    5294                         if (0) 
     5324                        if (1) 
    52955325                        { 
    52965326                                VssRayContainer vcRays; 
     
    52985328 
    52995329                                raysOut = min((int)rays.size(), 100); 
     5330 
     5331                                Debug  << "here12 " << raysOut << endl; 
    53005332 
    53015333                                // collect intial view cells 
     
    53075339                                for (vit = leaves.begin(); vit != vit_end; ++ vit) 
    53085340                                { 
    5309                                         BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaf; 
     5341                                        VspLeaf *vcLeaf = dynamic_cast<VspViewCell *>(*vit)->mLeaf; 
    53105342                                 
    53115343                                        VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 
     
    53325364                 
    53335365                        // associate new rays with output view cell 
    5334                         if (1) 
     5366                        if (0) 
    53355367                        { 
    53365368                                VssRayContainer vcRays; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1027 r1047  
    3636class VspNode; 
    3737class HierarchyManager; 
     38struct AxisAlignedPlane; 
    3839 
    3940struct BspRay; 
     
    349350        virtual void ExportViewCellGeometry(Exporter *exporter,  
    350351                                                                                ViewCell *vc, 
    351                                                                                 const Plane3 *clipPlane = NULL) const = 0; 
     352                                                                                const AxisAlignedPlane *clipPlane = NULL) const = 0; 
    352353 
    353354        /** Brings the view cells into their final state, computes meshes and volume. 
     
    574575                 
    575576        //Environment *environment; 
    576         Plane3 mClipPlane; 
     577        AxisAlignedPlane mClipPlane; 
    577578 
    578579        bool mUseClipPlaneForViz; 
     
    704705        void ExportViewCellGeometry(Exporter *exporter,  
    705706                                                                ViewCell *vc,  
    706                                                                 const Plane3 *clipPlane = NULL) const; 
     707                                                                const AxisAlignedPlane *clipPlane = NULL) const; 
    707708         
    708709        void CollectMergeCandidates(const VssRayContainer &rays,  
     
    788789        void ExportViewCellGeometry(Exporter *exporter,  
    789790                                                                ViewCell *vc, 
    790                                                                 const Plane3 *clipPlane = NULL) const; 
     791                                                                const AxisAlignedPlane *clipPlane = NULL) const; 
    791792 
    792793        void CollectMergeCandidates(const VssRayContainer &rays,  
     
    860861        void ExportViewCellGeometry(Exporter *exporter,  
    861862                                                                ViewCell *vc, 
    862                                                                 const Plane3 *clipPlane = NULL) const; 
     863                                                                const AxisAlignedPlane *clipPlane = NULL) const; 
    863864 
    864865        //float GetVolume(ViewCell *viewCell) const; 
     
    10011002        void ExportViewCellGeometry(Exporter *exporter,  
    10021003                                                                ViewCell *vc, 
    1003                                                                 const Plane3 *clipPlane = NULL) const; 
     1004                                                                const AxisAlignedPlane *clipPlane = NULL) const; 
    10041005 
    10051006        int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp

    r1020 r1047  
    3434                                                          const RgbColor &color) 
    3535{ 
     36        if (rays.empty()) 
     37                return false; 
    3638  RayContainer::const_iterator ri = rays.begin(); 
    3739 
     
    4850  { 
    4951          stream << index << " " << index + 1 << " -1\n"; 
    50           index+=2; 
     52          index += 2; 
    5153  } 
    5254   
     
    6870          else 
    6971          { 
    70                   if ((*ri)->intersections.size()==0) 
     72                  if ((*ri)->intersections.empty()) 
    7173                          b = (*ri)->GetLoc() + length*(*ri)->GetDir(); 
    7274                  else 
     
    8183  stream << "}" << endl; 
    8284  stream << "}" << endl; 
    83   //stream << "}" << endl; 
    84  
     85   
    8586  return true; 
    8687} 
     
    9091                                                          const RgbColor &color) 
    9192{ 
    92   VssRayContainer::const_iterator ri = rays.begin(); 
     93 
     94        if (rays.empty()) 
     95                return false; 
    9396 
    9497  stream << "Shape {" << endl; 
     
    98101  stream << "}" << endl; // end material 
    99102  stream << "}" << endl; // end appearance 
    100    
     103  Debug << "here8" << endl; 
    101104  stream << "geometry IndexedLineSet { coordIndex [" << endl; 
    102105 
    103106  int index = 0; 
    104   for (; ri != rays.end(); ri++)  
     107  VssRayContainer::const_iterator ri = rays.begin(); 
     108 
     109  for (; ri != rays.end(); ++ ri)  
    105110  { 
    106111          stream << index << " " << index + 1 << " -1\n"; 
    107           index +=2 ; 
     112          index += 2 ; 
    108113  } 
    109114   
     
    112117  stream << "coord Coordinate { point [" << endl; 
    113118   
    114   ri = rays.begin(); 
    115   for (; ri != rays.end(); ri++) { 
    116     const Vector3 a = (*ri)->GetOrigin(); 
    117         const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 
    118         //const Vector3 b = (*ri)->GetTermination(); // matt: change back!! 
    119  
    120     stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
    121         stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     119  for (ri = rays.begin(); ri != rays.end(); ++ ri)  
     120  { 
     121          const Vector3 a = (*ri)->GetOrigin(); 
     122          const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 
     123          //const Vector3 b = (*ri)->GetTermination(); // matt: change back!! 
     124 
     125          stream << a.x << " " << a.y << " " << a.z << " ,"; 
     126          stream << b.x << " " << b.y << " " << b.z << " ,\n"; 
    122127  } 
     128 
    123129  stream << "]" << endl; 
    124130  stream << "}" << endl; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r1027 r1047  
    848848 
    849849                mBspStats.contributingSamples += conSamp; 
    850                 mBspStats.sampleContributions +=(int) sampCon; 
     850                mBspStats.sampleContributions += (int)sampCon; 
    851851 
    852852                //-- store additional info 
     
    12241224                        sc += contribution; 
    12251225                } 
    1226            
    1227           sampleContributions += sc; 
    1228  
    1229           if (madeContrib) 
    1230                   ++ contributingSamples; 
    1231                  
    1232           //leaf->mVssRays.push_back(ray); 
     1226                 
     1227                sampleContributions += sc; 
     1228                 
     1229                if (madeContrib) 
     1230                        ++ contributingSamples; 
     1231                 
     1232                if (0) leaf->mVssRays.push_back(new VssRay(*ray)); 
    12331233        } 
    12341234} 
     
    15731573                                         
    15741574                                        // create back geometry from box 
    1575                                         // NOTE: the geometry is saved when possible 
     1575                                        // NOTE: the geometry is returned from the function so we 
     1576                                        // don't have to recompute it when possible 
    15761577                                        pos = box.Max(); pos[axis] = nPosition[axis]; 
    15771578                                        AxisAlignedBox3 bBox(box.Min(), pos); 
     
    24722473                        extp = splitPlane.FindIntersection(ray.GetLoc(), extp, &t); 
    24732474                        maxt *= t; 
    2474  
    2475                 } else // reached leaf => intersection with view cell 
     2475                }  
     2476                else // reached leaf => intersection with view cell 
    24762477                { 
    24772478                        BspLeaf *leaf = dynamic_cast<BspLeaf *>(node); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1027 r1047  
    771771                        sc += contribution; 
    772772                } 
    773            
    774           sampleContributions += sc; 
    775  
    776           if (madeContrib) 
    777                   ++ contributingSamples; 
     773          
     774                sampleContributions += sc; 
     775 
     776                if (madeContrib) 
     777                        ++ contributingSamples; 
    778778                 
    779           //leaf->mVssRays.push_back(ray); 
    780         } 
    781 } 
    782  
    783  
    784 void VspTree::SortSplitCandidates(const RayInfoContainer &rays,  
    785                                                                         const int axis,  
    786                                                                         float minBand,  
    787                                                                         float maxBand) 
     779                if (1) leaf->mVssRays.push_back(new VssRay(*ray)); 
     780        } 
     781} 
     782 
     783 
     784void VspTree::SortSplitCandidates(const RayInfoContainer &rays, 
     785                                                                  const int axis,  
     786                                                                  float minBand,  
     787                                                                  float maxBand) 
    788788{ 
    789789        mSplitCandidates->clear(); 
    790790 
    791791        int requestedSize = 2 * (int)(rays.size()); 
     792 
    792793        // creates a sorted split candidates array 
    793794        if (mSplitCandidates->capacity() > 500000 && 
     
    863864 
    864865         
    865         // if no border can be found, take mid split 
     866        // if no good split can be found, take mid split 
    866867        position = minBox + 0.5f * sizeBox; 
    867868         
     
    952953                                } 
    953954                } 
    954  
    955955                 
    956956                 
     
    978978         
    979979        // -- compute cost 
     980 
    980981        const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 
    981982        const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 
    982983 
    983984        const float pOverall = sizeBox; 
    984  
    985985        const float pBack = position - minBox; 
    986986        const float pFront = maxBox - position; 
    987          
     987 
     988        /*const float pOverall = box.GetVolume(); 
     989 
     990        AxisAlignedBox3 bbox; 
     991        AxisAlignedBox3 fbox; 
     992 
     993        box.Split(axis, position, bbox, fbox); 
     994 
     995        const float pBack = fbox.GetVolume(); 
     996        const float pFront = bbox.GetVolume();*/ 
     997 
    988998        const float penaltyOld = EvalPvsPenalty(pvsSize, lowerPvsLimit, upperPvsLimit); 
    989999    const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 
    9901000        const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 
    9911001         
    992         const float oldRenderCost = penaltyOld * pOverall; 
     1002        const float oldRenderCost = penaltyOld * pOverall + Limits::Small; 
    9931003        const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 
    9941004 
    9951005        if (splitPlaneFound) 
    9961006        { 
    997                 ratio = newRenderCost / (oldRenderCost + Limits::Small); 
     1007                ratio = newRenderCost / oldRenderCost; 
    9981008        } 
    9991009        //if (axis != 1) 
     
    10211031        int bestAxis = -1; 
    10221032 
     1033        //mOnlyDrivingAxis = true; 
     1034 
    10231035        // if we use some kind of specialised fixed axis 
    10241036    const bool useSpecialAxis =  
    10251037                mOnlyDrivingAxis || mCirculatingAxis; 
    1026  
    1027         int parentAxis = 0; 
    1028         VspNode *parent = tData.mNode->GetParent(); 
    1029  
    1030         if (parent) 
    1031                 parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis(); 
    1032  
     1038        Debug << "data: " << tData.mBoundingBox << " pvs " << tData.mPvs << endl; 
    10331039        if (mCirculatingAxis) 
     1040        { 
     1041                int parentAxis = 0; 
     1042                VspNode *parent = tData.mNode->GetParent(); 
     1043 
     1044                if (parent) 
     1045                        parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis(); 
     1046 
    10341047                sAxis = (parentAxis + 1) % 3; 
     1048        } 
    10351049        else if (mOnlyDrivingAxis) 
     1050        { 
    10361051                sAxis = box.Size().DrivingAxis(); 
    1037  
    1038  
    1039         for (int axis = 0; axis < 3 ; ++ axis) 
     1052        } 
     1053        //sAxis = 2; 
     1054        for (int axis = 0; axis < 3; ++ axis) 
    10401055        { 
    10411056                if (!useSpecialAxis || (axis == sAxis)) 
     
    10701085                        else if (nCostRatio[axis] < nCostRatio[bestAxis]) 
    10711086                        { 
     1087                                Debug << "old: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
    10721088                                bestAxis = axis; 
     1089                                 
     1090                                Debug << "new: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
    10731091                        }  
    10741092                } 
    10751093        } 
    10761094 
     1095 
    10771096        //-- assign values 
     1097         
    10781098        plane.mAxis = bestAxis; 
     1099        // split plane position 
     1100    plane.mPosition = nPosition[bestAxis]; 
     1101 
    10791102        pFront = nProbFront[bestAxis]; 
    10801103        pBack = nProbBack[bestAxis]; 
    10811104 
    1082         //-- split plane position 
    1083     plane.mPosition = nPosition[bestAxis]; 
    1084  
     1105 
     1106        Debug << "val: " << nCostRatio[bestAxis] << " axis: " << bestAxis << endl; 
    10851107        return nCostRatio[bestAxis]; 
    10861108} 
     
    10981120                                                                          const VspTraversalData &data) const 
    10991121{ 
    1100 #if 1 
    1101         return -data.mDepth; 
     1122#if 0 
     1123        return (float)-data.mDepth; 
    11021124#endif 
    11031125        float pvsFront = 0; 
     
    17521774                                if (extp[axis] <= position) 
    17531775                                { 
    1754                                         node = in->GetFront(); 
     1776                                        node = in->GetBack(); 
    17551777                                        // cases N1,N2,N3,P5,Z2,Z3 
    17561778                                        continue; 
     
    17581780                                { 
    17591781                                        // case N4 
    1760                                         node = in->GetFront(); 
    1761                                         farChild = in->GetBack(); 
     1782                                        node = in->GetBack(); 
     1783                                        farChild = in->GetFront(); 
    17621784                                } 
    17631785                        } 
     
    17661788                                if (position <= extp[axis]) 
    17671789                                { 
    1768                                         node = in->GetBack(); 
     1790                                        node = in->GetFront(); 
    17691791                                        // cases P1,P2,P3,N5,Z1 
    17701792                                        continue; 
     
    17721794                                else 
    17731795                                { 
    1774                                         node = in->GetBack(); 
    1775                                         farChild = in->GetFront(); 
     1796                                        node = in->GetFront(); 
     1797                                        farChild = in->GetBack(); 
    17761798                                        // case P4 
    17771799                                } 
     
    20862108                // get classification and receive new t 
    20872109                //-- test if start point behind or in front of plane 
    2088                 const int side = plane.ComputeRayIntersection(bRay, t); 
     2110                const int side = bRay.ComputeRayIntersection(plane.mAxis, plane.mPosition, t); 
     2111                         
     2112 
    20892113#if 1 
    20902114                if (side == 0) 
     
    21572181        AxisAlignedBox3 box(parent->GetBoundingBox()); 
    21582182 
    2159         if (parent->GetBack() == node) 
    2160                 box.SetMin(parent->GetAxis(), parent->GetPosition()); 
    2161         else 
    2162                 box.SetMax(parent->GetAxis(), parent->GetPosition()); 
     2183        if (parent->GetFront() == node) 
     2184      box.SetMin(parent->GetAxis(), parent->GetPosition()); 
     2185    else 
     2186      box.SetMax(parent->GetAxis(), parent->GetPosition()); 
    21632187 
    21642188        return box; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1027 r1047  
    4242                return c1->GetPriority() < c2->GetPriority(); 
    4343        } 
    44 }; 
    45  
    46 /** A definition for an axis aligned plane. 
    47 */ 
    48 struct AxisAlignedPlane 
    49 { 
    50 public: 
    51  
    52         /** Computes intersection of this plane with the ray segment. 
    53         */ 
    54         int ComputeRayIntersection(const RayInfo &rayData, float &t) const 
    55         { 
    56                 return rayData.ComputeRayIntersection(mAxis, mPosition, t); 
    57         } 
    58  
    59         /// the split axis: one of 0=x, 1=y, 2=z 
    60         int mAxis; 
    61         /// the absolute position of the split axis 
    62         float mPosition; 
    6344}; 
    6445 
     
    410391        void SetBoundingBox(const AxisAlignedBox3 &box); 
    411392 
     393        /** Computes intersection of this plane with the ray segment. 
     394        */ 
     395        int ComputeRayIntersection(const RayInfo &rayData, float &t) const 
     396        { 
     397                return rayData.ComputeRayIntersection(mPlane.mAxis, mPlane.mPosition, t); 
     398        } 
     399 
     400 
    412401protected: 
    413402 
Note: See TracChangeset for help on using the changeset viewer.