Commit af548402 authored by Sabrina Templeton's avatar Sabrina Templeton
Browse files

hexagonal mesh number tweaks

parent 7348d363
......@@ -24,7 +24,7 @@ float random (vec2 uv) {
void
get_color( float u , out vec3 color ) {
// This line turns on the random shading (for structured points)
u = random( vec2(v_Index,v_Index) ) * (u_nb_points+1);
//u = random( vec2(v_Index,v_Index) ) * (u_nb_points+1);
float umin = 0.;
float umax = u_nb_points +1;
......
......@@ -126,11 +126,11 @@ UT_TEST_CASE( test1 )
// *************************************************************************
//generate random seeds desired times 3
int num_points = 1e3;
int num_points = 1e6;
int size = num_points*3;
int MODE = 2; // 0 is random, 1 is square, 2 is hexagonal
int MODE = 0; // 0 is random, 1 is square, 2 is hexagonal
// *************************************************************************
......@@ -155,13 +155,13 @@ if (MODE == 0){
//std::cout << "Test Print!!!!!!!!!!!!!";
}
else if (MODE == 1){
float dx = 1 / (sqrt(num_points) + 1); //delta y is the same if we're going for a grid
float dx = 1 / (sqrt(num_points) ); //delta y is the same if we're going for a grid
//std::cout << dx << std::endl;
for (int i = 1; i < sqrt(num_points) +1; i ++ ){
for (int j = 1; j < sqrt(num_points) +1; j ++ ){
for (int i = 0; i < sqrt(num_points) ; i ++ ){
for (int j = 0; j < sqrt(num_points); j ++ ){
float x = j * dx;
float y = i * dx;
float x = j * dx + dx/2;
float y = i * dx + dx/2;
seeds.push_back(x);
seeds.push_back(y);
seeds.push_back(0.0);
......@@ -178,12 +178,12 @@ else if (MODE == 2){
float dx = 1/(sqrt(num_points)-1); // idk what number to put here
float dx = 1/(sqrt(num_points) ); // idk what number to put here
float dy = (sqrt(3)/2) * dx;
//std::cout << sqrt(num_points)/dy << std::endl;
for (int i = 0; i < 1/dy; i ++ ){
for (int i = 0; i < 1/dy + 1; i ++ ){
if ((i % 2) == 0) {
for (int j = 0; j < 1/dx; j ++ ){
for (int j = 0; j < 1/(dx) ; j ++ ){
float x = (j * dx) + dx/2;
float y = i * dy;
seeds.push_back(x);
......@@ -194,7 +194,7 @@ else if (MODE == 2){
}
else{
for (int j = 0; j < 1/dx; j ++ ){
for (int j = 0; j < 1/dx + 1; j ++ ){
float x = j * dx;
float y = i * dy;
seeds.push_back(x);
......@@ -374,7 +374,7 @@ else if (MODE == 2){
points_remaining -= call_size;
first_point_to_draw += call_size;
}
*/
} */
GLuint query;
//GLuint64 elapsed_time;
......@@ -401,11 +401,12 @@ else if (MODE == 2){
printf("--> GPU run time = %f seconds\n", time/1e9 );//real_t(TIME3-TIME2)/real_t(CLOCKS_PER_SEC));
std::ofstream myfile;
pFile = fopen ("results.txt", "a");
pFile = fopen ("dis_results.txt", "a");
//fprintf(pFile, "--> nearest neighbor calculation time = %g seconds\n",real_t(TIME1-TIME0)/real_t(CLOCKS_PER_SEC));
//fprintf(pFile, "--> GPU run time = %f seconds\n", time/1e9 );
//fprintf(pFile, "1e6 & %.2E & %.2E \\\\ \n", real_t((TIME1-TIME0)/real_t(CLOCKS_PER_SEC)\nb_thread, time/1e9 );
fprintf(pFile, "%12.3e\n", time/1e9 );
// fprintf(pFile, "--> GPU run time = %f seconds\n", time/1e9 );
//fprintf(pFile, "3e6 & %.2E & %.2E \\\\ \n", real_t(TIME1-TIME0)/real_t(CLOCKS_PER_SEC)/nb_thread, time/1e9 );
//std::cout << nb_thread;
//std::cout << "should have written to a file.";
......
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