Show
Ignore:
Timestamp:
11/27/05 16:32:57 (9 years ago)
Author:
robert
Message:

From Geoff Michel, fix for the scaling of the random number generation.

Files:
1 modified

Legend:

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

    r4845 r4847  
    1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield 
     1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield  
    22* 
    33* This application is open source and may be redistributed and/or modified    
     
    140140 
    141141class LinearConstraint: public osgUtil::DelaunayConstraint {  
    142 /** forces edges of a "Images/road" to fit triangles 
     142/** forces edges of a "road" to fit triangles 
    143143*  if 2 roads cross, then the overlap will be replaced by a 'cross road' 
    144144    *  and the roads built up to the cross roads with a texture along its length. */ 
     
    266266    int j=np%maxp; 
    267267    // make the random scale 0.00 if you want an equispaced XY grid. 
    268     float x=3000.0/(maxp-1)*i+0.00052*rand(); 
    269     float y=3000.0/(maxp-1)*j+0.0005*rand(); 
     268    float x=3000.0/(maxp-1)*i+16.*(float)rand()/RAND_MAX; 
     269    float y=3000.0/(maxp-1)*j+16.*(float)rand()/RAND_MAX; 
    270270    float z=getheight(x,y); 
    271271    if (np>=maxp*maxp) z=-1.e32; 
     
    381381    osg::ref_ptr<osgUtil::DelaunayConstraint> dc; 
    382382    std::ostringstream what; 
    383     if (1==1) { // add a simple constraint of few points 
     383    if (1==0) { // add a simple constraint of few points 
    384384        osg::ref_ptr<osgUtil::DelaunayConstraint> dc=new osgUtil::DelaunayConstraint; 
    385385        osg::Vec3Array *bounds=new osg::Vec3Array; 
     
    639639                geode->addDrawable(dc2->makeAreal(arpts.get())); // this creates fill in geometry 
    640640                 
    641                 if (ndcs>4) { // a simple "Images/road" 
     641                if (ndcs>4) { // a simple "road" 
    642642                    trig->removeInternalTriangles(dc3.get()); 
    643643                    dc3->setTexture ("Images/road.png"); 
     
    11261126} 
    11271127 
    1128 osg::Vec3Array *LinearConstraint::getRoadNormals(const osg::Vec3Array*) const 
     1128osg::Vec3Array *LinearConstraint::getRoadNormals(const osg::Vec3Array *points) const 
    11291129{ 
    11301130    osg::Vec3Array *nrms=new osg::Vec3Array;