Show
Ignore:
Timestamp:
07/15/10 13:32:31 (4 years ago)
Author:
robert
Message:

Added handling of duplicate vertices

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgtext3D/osgtext3D.cpp

    r11676 r11678  
    8888    osg::Vec3 v21(v2-v1); 
    8989    osg::Vec3 v32(v3-v2); 
    90     v21.normalize(); 
    91     v32.normalize(); 
     90    float length_21 = v21.normalize(); 
     91    float length_32 = v32.normalize(); 
     92 
     93    float t = 5.0; 
     94    if (length_21==0.0) 
     95    { 
     96        OSG_NOTICE<<"length_21=="<<length_21<<", length_32="<<length_32<<std::endl; 
     97        osg::Vec3 bisector = v32 ^ osg::Vec3(0.0f,0.0f,1.0f); 
     98        bisector.normalize(); 
     99        osg::Vec3 new_vertex = v2 + bisector * t; 
     100        return new_vertex; 
     101    } 
     102    else if (length_32==0.0) 
     103    { 
     104        OSG_NOTICE<<"length_21=="<<length_21<<", length_32="<<length_32<<std::endl; 
     105        osg::Vec3 bisector = v21 ^ osg::Vec3(0.0f,0.0f,1.0f); 
     106        bisector.normalize(); 
     107        osg::Vec3 new_vertex = v2 + bisector * t; 
     108        return new_vertex; 
     109    } 
     110 
    92111    osg::Vec3 cross = v21^v32; 
    93  
    94     float t = 5.0; 
    95  
    96112    osg::Vec3 bisector(v32-v21); 
    97113