This commit is contained in:
Shuo Feng 2024-01-28 20:14:37 -05:00
commit de866d23bf
Signed by: sfeng
GPG key ID: 1E83AE6CD1C037B1
28 changed files with 46878 additions and 0 deletions

43
external/test_ppm.cpp vendored Normal file
View file

@ -0,0 +1,43 @@
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>
#include "json.hpp"
#include "simpleppm.h"
#include <sstream>
using namespace std;
using namespace nlohmann;
int test_save_ppm(){
int dimx = 800;
int dimy = 600;
int w = 100;
std::vector<double> buffer(3*dimx*dimy);
for(int j=0;j<dimy;++j){
for(int i=0;i<dimx;++i){
if(((i+j)/w)%2==0){
buffer[3*j*dimx+3*i+0]=1;
buffer[3*j*dimx+3*i+1]=1;
buffer[3*j*dimx+3*i+2]=0;
} else {
buffer[3*j*dimx+3*i+0]=0;
buffer[3*j*dimx+3*i+1]=1;
buffer[3*j*dimx+3*i+2]=1;
}
}
}
save_ppm("test.ppm", buffer, dimx, dimy);
return 0;
}