Ignore:
Timestamp:
03/20/06 00:11:27 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r704 r710  
    159159    mFront = f; 
    160160} 
     161 
    161162 
    162163/****************************************************************/ 
     
    588589} 
    589590 
     591 
    590592int BspTree::AddMeshToPolygons(Mesh *mesh,  
    591593                                                           PolygonContainer &polys,  
    592594                                                           MeshInstance *parent) 
    593595{ 
    594         FaceContainer::const_iterator fi; 
     596        FaceContainer::const_iterator fi, fi_end = mesh->mFaces.end(); 
    595597         
    596598        // copy the face data to polygons 
    597         for (fi = mesh->mFaces.begin(); fi != mesh->mFaces.end(); ++ fi) 
     599        for (fi = mesh->mFaces.begin(); fi != fi_end; ++ fi) 
    598600        { 
    599601                Polygon3 *poly = new Polygon3((*fi), mesh); 
     
    28392841{ 
    28402842        mPolys.reserve(rhs.mPolys.size()); 
    2841          
     2843        mPlanes.reserve(rhs.mPolys.size()); 
     2844 
     2845 
    28422846        PolygonContainer::const_iterator it, it_end = rhs.mPolys.end(); 
    28432847 
    28442848        int i = 0; 
    28452849 
    2846         for (it = rhs.mPolys.begin(); it != it_end; ++ it) 
     2850        for (it = rhs.mPolys.begin(); it != it_end; ++ it, ++i) 
    28472851        { 
    28482852                Polygon3 *poly = *it; 
    2849                 Add(new Polygon3(*poly), rhs.mPlanes[i ++]); 
     2853                Add(new Polygon3(*poly), rhs.mPlanes[i]); 
     2854        } 
     2855} 
     2856 
     2857 
     2858BspNodeGeometry& BspNodeGeometry::operator=(const BspNodeGeometry& g)  
     2859{ 
     2860    if (this == &g)  
     2861                return *this; 
     2862  
     2863        CLEAR_CONTAINER(mPolys); 
     2864 
     2865        mPolys.reserve(g.mPolys.size()); 
     2866        mPlanes.reserve(g.mPolys.size()); 
     2867 
     2868        PolygonContainer::const_iterator it, it_end = g.mPolys.end(); 
     2869 
     2870        int i = 0; 
     2871 
     2872        for (it = g.mPolys.begin(); it != it_end; ++ it, ++ i) 
     2873        { 
     2874                Polygon3 *poly = *it; 
     2875                Add(new Polygon3(*poly), g.mPlanes[i]); 
     2876        } 
     2877 
     2878        return *this; 
     2879} 
     2880 
     2881 
     2882BspNodeGeometry::BspNodeGeometry(const PolygonContainer &polys) 
     2883{ 
     2884        mPolys = polys; 
     2885        mPlanes.reserve(polys.size()); 
     2886         
     2887        PolygonContainer::const_iterator it, it_end = polys.end(); 
     2888 
     2889        for (it = polys.begin(); it != it_end; ++ it) 
     2890        { 
     2891                Polygon3 *poly = *it; 
     2892                mPlanes.push_back(poly->GetSupportingPlane()); 
    28502893        } 
    28512894} 
     
    29222965 
    29232966 
    2924 int BspNodeGeometry::Side(const Plane3 &plane) const 
     2967int BspNodeGeometry::Side(const Plane3 &plane, const float eps) const 
    29252968{ 
    29262969        PolygonContainer::const_iterator it, it_end = mPolys.end(); 
     
    29312974        for (it = mPolys.begin(); it != it_end; ++ it) 
    29322975        { 
    2933         const int side = (*it)->Side(plane, 0.0f); 
     2976        const int side = (*it)->Side(plane, eps); 
    29342977 
    29352978                if (side == -1) 
     
    30423085                                                                        const float epsilon) const 
    30433086{        
     3087#if 0 
     3088        // trivial cases 
     3089        const int cf = Side(splitPlane, epsilon); 
     3090 
     3091        if (cf == -1) 
     3092        { 
     3093                back = *this; 
     3094                return false; 
     3095        } 
     3096        else if (cf == 1) 
     3097        { 
     3098                front = *this; 
     3099                return false; 
     3100        } 
     3101#endif 
     3102 
    30443103        // get cross section of new polygon 
    30453104        Polygon3 *planePoly = box.CrossSection(splitPlane); 
    3046         //Vector3 ndummy = planePoly->GetSupportingPlane().mNormal; 
     3105         
    30473106        // split polygon with all other polygons 
    30483107        planePoly = SplitPolygon(planePoly, epsilon); 
Note: See TracChangeset for help on using the changeset viewer.