Commit 1bb65ff9 authored by Sabrina Templeton's avatar Sabrina Templeton
Browse files

working test case diagram, nearest neighbors is no longer hardcoded

parent ecd78b58
......@@ -113,7 +113,7 @@ UT_TEST_CASE( test1 )
// };
std::vector<real_t> seeds_d( seeds.begin() , seeds.end() ); //convert the seeds to double
/*
//compute the nearest neighbors here
GEO::NearestNeighborSearch* nns = GEO::NearestNeighborSearch::create(3,"BNN"); // number of dimensions is really 2, but we have been using three
......@@ -132,11 +132,12 @@ UT_TEST_CASE( test1 )
index_t nb_neighbors = 7; // since there are only seven points right now, this number will probably be more like 50 later
std::vector<index_t> neighbors(nb_neighbors);
std::vector<index_t> total_neighbors(nb_neighbors * num_points); // i don't know if this is the correct number if, for example, nb points and nb neighbors are not the same (which they usually will not be)
std::vector<double> neighbors_sq_dist(nb_neighbors);
index_t i = 0;
for (index_t k=0;k<num_points;k++)
{
nns->get_nearest_neighbors( nb_neighbors , k , neighbors.data() , neighbors_sq_dist.data() );
......@@ -146,6 +147,15 @@ UT_TEST_CASE( test1 )
//print_inline(neighbors);
//here we need to resave the neighbors in a new full neighbors array before moving on
for (index_t j = 0; j < num_points; j++){
//total_neighbors[((k+1)*i)-1] = neighbors[i];
total_neighbors[i] = neighbors[j];
i++;
}
}
......@@ -159,16 +169,21 @@ UT_TEST_CASE( test1 )
// };
*/
std::vector<int> neighbors_x = {
0, 1, 2, 3, 4, 5, 6,
1, 0, 4, 3, 2, 5, 6,
2, 0, 1, 3, 4, 5, 6,
3, 0, 1, 2, 4, 5, 6,
4, 1, 0, 2, 3, 5, 6,
5, 6, 3, 2, 0, 1, 4,
6, 5, 3, 2, 0, 1, 4
};
// std::vector<GLuint> neighbors_x = {
// 0, 1, 2, 3, 4, 5, 6,
// 1, 0, 4, 3, 2, 5, 6,
// 2, 0, 1, 3, 4, 5, 6,
// 3, 0, 1, 2, 4, 5, 6,
// 4, 1, 0, 2, 3, 5, 6,
// 5, 6, 3, 2, 0, 1, 4,
// 6, 5, 3, 2, 0, 1, 4
// };
// convert nearest neighbor type
std::vector<GLuint> neighbors_f( total_neighbors.begin() , total_neighbors.end() );
graphics::gl_index points_buffer;
GL_CALL( glGenBuffers( 1 , &points_buffer) );
GL_CALL( glBindBuffer( GL_ARRAY_BUFFER , points_buffer ) );
......@@ -179,7 +194,7 @@ UT_TEST_CASE( test1 )
graphics::gl_index nn_buffer;
GL_CALL( glGenBuffers( 1 , &nn_buffer) );
GL_CALL( glBindBuffer( GL_TEXTURE_BUFFER , nn_buffer ) );
GL_CALL( glBufferData( GL_TEXTURE_BUFFER , sizeof(int) * neighbors_x.size() , neighbors_x.data() , GL_STATIC_DRAW ) );
GL_CALL( glBufferData( GL_TEXTURE_BUFFER , sizeof(GLuint) * neighbors_f.size() , neighbors_f.data() , GL_STATIC_DRAW ) );
//GL_CALL( glBindBuffer( GL_ARRAY_BUFFER , 0 ) );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment