trick

trick

 _numTriangles = _numCellsPerRow * _numCellsPerCol * 2;
// 三角形的数目 = 横边的数目*竖边的数目*2;

// 求randfloat from lowBound to highBound
float  d3d::GetRandomFloat( float  lowBound,  float  highBound)
{
    
if( lowBound >= highBound ) // bad input
        return lowBound;

    
// get random float in [0, 1] interval
    float f = (rand() % 10000* 0.0001f

    
// return float in [lowBound, highBound] interval. 
    return (f * (highBound - lowBound)) + lowBound; 
}

你可能感兴趣的:(trick)