diff --git a/.gitmodules b/.gitmodules index 6893075..51c2db9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "3-Modeling/c++/deps/polyscope"] - path = 3-Modeling/c++/deps/polyscope +[submodule "3-modeling/c++/deps/polyscope"] + path = 3-modeling/c++/deps/polyscope url = https://github.com/nmwsharp/polyscope.git diff --git a/3-modeling/c++/simpleTest.cpp b/3-modeling/c++/simpleTest.cpp new file mode 100644 index 0000000..afb743d --- /dev/null +++ b/3-modeling/c++/simpleTest.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include +#include "polyscope/polyscope.h" +#include "polyscope/point_cloud.h" +#include "polyscope/surface_mesh.h" + +int main(int argc, char **argv) +{ + // Initialize polyscope + polyscope::init(); + + //Some data + std::vector> pts={{0,0,0}, {0,0,1}, {0,1,0}, {1,0,0}, {1,1,0},{0,1,1},{1,0,1},{1,1,1}}; + std::vector values = {0.3, 3.4, 0.2, 0.4, 1.2, 4.0,3.6,5.0}; + + auto pcl = polyscope::registerPointCloud("My Points", pts); + pcl->addScalarQuantity("Some values", values); + + // Give control to the polyscope gui + polyscope::show(); + + return EXIT_SUCCESS; +} diff --git a/3-modeling/c++/simppleTest.cpp b/3-modeling/c++/simppleTest.cpp deleted file mode 100644 index c62731b..0000000 --- a/3-modeling/c++/simppleTest.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include -#include -#include -#include "polyscope/polyscope.h" -#include "polyscope/point_cloud.h" - -#include "deps/CLI11.hpp" - -void processFile(const std::string &filename, - const std::vector &vectorCols) -{ - std::vector> pc; - std::vector> alldata; - std::ifstream ifs(filename); - double x,y,z; - std::string line; - while(std::getline(ifs, line)) - { - std::stringstream linestream(line); - std::vector data; - auto i=0; - while(linestream.good()) - { - double v; - linestream >> v; - data.push_back(v); - ++i; - } - pc.push_back({data[0],data[1],data[2]}); - alldata.push_back(data); - } - std::cout< scalars; - for(auto i=0u; i < alldata.size(); ++i) - scalars.push_back(alldata[i][col]); - ps->addScalarQuantity("Scalar col"+std::to_string(col), scalars); - } - else - { - std::vector> V; - for(auto i=0u; i < alldata.size(); ++i) - V.push_back({alldata[i][col],alldata[i][col+1],alldata[i][col+2]}); - ps->addVectorQuantity("Vector col"+std::to_string(col), V); - col +=2; - } - } -} - -int main(int argc, char **argv) -{ - CLI::App app{"displayPTS"}; - std::vector filenames; - app.add_option("-i,--input,1", filenames, "Input point clouds") - ->required(); - std::vector vectorCols; - app.add_option("--vectorCols", vectorCols, "Indices of columns to group as vectors (col col+1 col+2)"); - CLI11_PARSE(app,argc,argv); - - auto errorMSG=[&](const size_t vi, const size_t vj){ - std::cout<<"Error while parsing the vectorCols: "; - std::cout<<"("<