29 template<
class Real >
32 _fp = fopen( fileName ,
"r" );
33 if( !_fp ) fprintf( stderr ,
"Failed to open file for reading: %s\n" , fileName ) , exit( 0 );
35 template<
class Real >
41 template<
class Real >
43 template<
class Real >
47 if( fscanf( _fp ,
" %8f %8f %8f %8f %8f %8f " , &c[0] , &c[1] , &c[2] , &c[3] , &c[4] , &c[5] )!=2*DIMENSION )
return false;
48 p[0] = c[0] , p[1] = c[1] , p[2] = c[2];
49 n[0] = c[3] , n[1] = c[4] , n[2] = c[5];
52 template<
class Real >
55 _pointsInBuffer = _currentPointIndex = 0;
56 _fp = fopen( fileName ,
"rb" );
57 if( !_fp ) fprintf( stderr ,
"Failed to open file for reading: %s\n" , fileName ) , exit( 0 );
59 template<
class Real >
65 template<
class Real >
68 fseek( _fp , SEEK_SET , 0 );
69 _pointsInBuffer = _currentPointIndex = 0;
71 template<
class Real >
74 if( _currentPointIndex<_pointsInBuffer )
76 p[0] = _pointBuffer[ _currentPointIndex*6+0 ];
77 p[1] = _pointBuffer[ _currentPointIndex*6+1 ];
78 p[2] = _pointBuffer[ _currentPointIndex*6+2 ];
79 n[0] = _pointBuffer[ _currentPointIndex*6+3 ];
80 n[1] = _pointBuffer[ _currentPointIndex*6+4 ];
81 n[2] = _pointBuffer[ _currentPointIndex*6+5 ];
87 _currentPointIndex = 0;
88 _pointsInBuffer = int( fread( _pointBuffer ,
sizeof( Real ) * 6 , POINT_BUFFER_SIZE , _fp ) );
89 if( !_pointsInBuffer )
return false;
90 else return nextPoint( p , n );