Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Install nanogui dependencies (ubuntu)
run: sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev
run: sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev libwayland-dev libdbus-1-dev libxkbcommon-dev
if: matrix.os == 'ubuntu-latest'

- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "external/nanogui"]
path = external/nanogui
url = https://github.com/mitsuba-renderer/nanogui.git
[submodule "external/ponca"]
path = external/ponca
url = https://github.com/poncateam/ponca.git
Expand All @@ -10,3 +7,6 @@
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb.git
[submodule "external/nanogui"]
path = external/nanogui
url = https://github.com/mitsuba-renderer/nanogui
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.10.0)

project("PoncaPlot")

Expand Down
2 changes: 1 addition & 1 deletion external/nanogui
Submodule nanogui updated 116 files
2 changes: 1 addition & 1 deletion external/ponca
Submodule ponca updated 82 files
+9 −3 .github/workflows/ContinuousTest.yml
+5 −7 .github/workflows/deployDoc.yml
+42 −1 CHANGELOG
+1 −1 CMakeLists.txt
+19 −23 Ponca/src/Fitting/algebraicSphere.h
+1 −0 Ponca/src/Fitting/algebraicSphere.hpp
+222 −107 Ponca/src/Fitting/basket.h
+61 −0 Ponca/src/Fitting/compute.h
+45 −0 Ponca/src/Fitting/covarianceFit.h
+64 −4 Ponca/src/Fitting/covarianceFit.hpp
+1 −0 Ponca/src/Fitting/covariancePlaneFit.h
+5 −1 Ponca/src/Fitting/covariancePlaneFit.hpp
+2 −2 Ponca/src/Fitting/curvature.hpp
+4 −4 Ponca/src/Fitting/curvatureEstimation.hpp
+1 −1 Ponca/src/Fitting/defines.h
+2 −2 Ponca/src/Fitting/linePrimitive.h
+7 −0 Ponca/src/Fitting/mean.h
+8 −8 Ponca/src/Fitting/mean.hpp
+2 −2 Ponca/src/Fitting/mlsSphereFitDer.hpp
+3 −2 Ponca/src/Fitting/mongePatch.hpp
+7 −5 Ponca/src/Fitting/orientedSphereFit.hpp
+3 −3 Ponca/src/Fitting/plane.h
+10 −7 Ponca/src/Fitting/primitive.h
+2 −2 Ponca/src/Fitting/sphereFit.hpp
+4 −4 Ponca/src/Fitting/unorientedSphereFit.hpp
+100 −13 Ponca/src/Fitting/weightFunc.h
+56 −3 Ponca/src/Fitting/weightKernel.h
+5 −5 Ponca/src/SpatialPartitioning/KdTree/kdTree.hpp
+66 −2 Ponca/src/SpatialPartitioning/KdTree/kdTreeTraits.h
+1 −1 Ponca/src/SpatialPartitioning/KnnGraph/Query/knnGraphRangeQuery.h
+1 −1 Ponca/src/SpatialPartitioning/KnnGraph/knnGraph.h
+3 −4 Ponca/src/SpatialPartitioning/indexSquaredDistance.h
+17 −8 Ponca/src/SpatialPartitioning/query.h
+2 −2 README.md
+1 −0 cmake/PoncaConfigureFitting.cmake
+3 −3 doc/examples/concepts.hpp
+189 −5 doc/src/concepts.mdoc
+1 −1 doc/src/example_cxx_binding.mdoc
+12 −1 doc/src/ponca.bib
+0 −42 doc/src/ponca_changelog.mdoc
+31 −60 doc/src/ponca_module_fitting.mdoc
+1 −2 doc/src/ponca_module_spatialpartitioning.mdoc
+2 −1 examples/cpp/nanoflann/nanoflann.hpp
+13 −6 examples/cpp/nanoflann/ponca_nanoflann.cpp
+2 −0 examples/cpp/pcl/CMakeLists.txt
+4 −5 examples/cpp/pcl/pcl_wrapper.hpp
+2 −3 examples/cpp/ponca_basic_cpu.cpp
+3 −5 examples/cpp/ponca_binding.cpp
+1 −1 examples/cpp/ponca_customize_kdtree.cpp
+1 −2 examples/cpp/ponca_fit_line.cpp
+1 −4 examples/cpp/ponca_fit_plane.cpp
+1 −1 examples/cpp/ponca_neighbor_search.cpp
+3 −2 examples/cuda/CMakeLists.txt
+7 −9 examples/cuda/ponca_ssgls.cu
+1 −1 external/eigen
+57 −23 tests/common/testUtils.h
+1 −0 tests/src/CMakeLists.txt
+1 −2 tests/src/algebraicsphere_primitive.cpp
+43 −82 tests/src/basket.cpp
+1 −2 tests/src/curvature_plane.cpp
+1 −2 tests/src/curvature_sphere.cpp
+1 −2 tests/src/dnormal_orthogonal_derivatives.cpp
+1 −2 tests/src/dnormal_plane.cpp
+1 −2 tests/src/dnormal_sphere.cpp
+1 −2 tests/src/dpotential_plane.cpp
+1 −2 tests/src/dpotential_sphere.cpp
+4 −6 tests/src/fit_cov.cpp
+2 −3 tests/src/fit_line.cpp
+1 −3 tests/src/fit_monge_patch.cpp
+32 −4 tests/src/fit_plane.cpp
+2 −3 tests/src/fit_radius_curvature_center.cpp
+3 −6 tests/src/fit_unoriented.cpp
+3 −7 tests/src/gls_compare.cpp
+21 −27 tests/src/gls_paraboloid_der.cpp
+1 −2 tests/src/gls_sphere_der.cpp
+1 −2 tests/src/gls_tau.cpp
+134 −0 tests/src/mls.cpp
+1 −2 tests/src/normal_plane.cpp
+1 −2 tests/src/normal_sphere.cpp
+12 −12 tests/src/projection.cpp
+3 −6 tests/src/scale_space_consistency.cpp
+61 −0 tests/src/weight_kernel.cpp
46 changes: 28 additions & 18 deletions src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,26 @@ namespace poncaplot {
Alignment::Middle, 0, 6));
auto *b = new Button(tools, "Open point cloud");
b->set_callback([&] {
auto path = file_dialog(
auto path = file_dialog( this, nanogui::FileDialogType::Open,
{{"dat", "Text file x y nx y"},
{"txt", "Text file x y nx y"}}, false);
std::cout << "Load file from: " << path << std::endl;
m_dataMgr->loadPointCloud(path);
{"txt", "Text file x y nx y"}});
if (path.empty() || path[0].empty()) {
std::cerr << "Open point cloud error : Received an empty file name" << std::endl; return;
}
std::cout << "Load file from: " << path[0] << std::endl;
m_dataMgr->loadPointCloud(path[0]);
pointIdSelector->set_max_value(m_dataMgr->getPointContainer().size() - 1);
});
b = new Button(tools, "Save point cloud");
b->set_callback([&] {
auto path = file_dialog(
auto path = file_dialog( this, nanogui::FileDialogType::Save,
{{"dat", "Text file x y nx y"},
{"txt", "Text file x y nx y"}}, true);
std::cout << "Save file to: " << path << std::endl;
m_dataMgr->savePointCloud(path);
{"txt", "Text file x y nx y"}});
if (path.empty() || path[0].empty()) {
std::cerr << "Save point cloud error : Received an empty file name" << std::endl; return;
}
std::cout << "Save file to: " << path[0] << std::endl;
m_dataMgr->savePointCloud(path[0]);
});
b = new Button(tools, "Fit point cloud view");
b->set_callback([&] {
Expand Down Expand Up @@ -98,23 +104,27 @@ namespace poncaplot {
});
b = new Button(tools, "Save image");
b->set_callback([&] {
auto path = file_dialog(
{{"png", "PNG image"}}, true);
if (path.empty()) return;
std::cout << "Save file to: " << path << std::endl;
auto path = file_dialog(this, nanogui::FileDialogType::Save,
{{"png", "PNG image"}});
if (path.empty() || path[0].empty()) {
std::cerr << "Save image error : Received an empty file name" << std::endl; return;
}
std::cout << "Save file to: " << path[0] << std::endl;

size_t factor = 2;
float *texture = new float[factor * tex_width * tex_height * 4];
renderPassesInternal(factor, texture);
write_image(tex_width*factor, tex_height*factor, texture, path);
write_image(tex_width*factor, tex_height*factor, texture, path[0]);
delete [] (texture);
});
b = new Button(tools, "Save sequence (scale)");
b->set_callback([&] {
auto path = file_dialog(
{{"", "basename"}}, true);
if (path.empty()) return;
std::cout << "Save sequence to: " << path << std::endl;
auto path = file_dialog( this, nanogui::FileDialogType::Save,
{{"", "basename"}});
if (path.empty() || path[0].empty()) {
std::cerr << "Save sequence (scale) error : Received an empty file name" << std::endl; return;
}
std::cout << "Save sequence to: " << path[0] << std::endl;

size_t factor = 2;
float *texture = new float[factor * tex_width * tex_height * 4];
Expand All @@ -126,7 +136,7 @@ namespace poncaplot {
{
scaleSlider->callback()(float(start+i));
std::ostringstream oss;
oss << path << std::setfill('0') << std::setw(4) << i << ".png";
oss << path[0] << std::setfill('0') << std::setw(4) << i << ".png";
renderPassesInternal(factor, texture);
write_image(tex_width*factor, tex_height*factor, texture, oss.str());
}
Expand Down
4 changes: 2 additions & 2 deletions src/dataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ DataManager::computeNormals(int k){
for (auto& pp : m_points){
VectorType p {pp.x(),pp.y()};
PlaneFit fit;
fit.setWeightFunc(WeightFunc());
fit.setWeightFunc({p});
// Set the evaluation position
fit.init(p);
fit.init();
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(m_tree.k_nearest_neighbors(p, k), m_tree.points()) == Ponca::STABLE) {
pp.z() = std::acos(fit.primitiveGradient().normalized().x());
Expand Down
10 changes: 4 additions & 6 deletions src/drawingPasses/bestFieldFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,15 @@ struct BestFitField : public SingleFitField<_FitType, DrawingPass> {
~BestFitField() override = default;

using FitType = _FitType;
using WeightFunc = typename FitType::WeightFunction;

/// Method called at the end of the fitting process, only for stable fits
virtual void postProcess(FitType& /*fit*/){};

inline float configureAndFit(const KdTree& points, FitType& fit, RenderingContext ctx) override {
// Configure computation to be centered on the point cloud coordinates
float scale = points.nodes()[0].getAabb()->diagonal().norm();
fit.setWeightFunc(WeightFunc(scale));
fit.init(points.nodes()[0].getAabb()->center());
fit.setWeightFunc({points.nodes()[0].getAabb()->center(), scale});
fit.init();
// Compute fit
fit.compute(points.points());
postProcess(fit);
Expand All @@ -106,19 +105,18 @@ struct OnePointFitField : public SingleFitField<_FitType, BaseFitField>, public
~OnePointFitField() override = default;

using FitType = _FitType;
using WeightFunc = typename FitType::WeightFunction;
using Scalar = typename FitType::Scalar;

/// Method called at the end of the fitting process, only for stable fits
virtual void postProcess(FitType& /*fit*/){};

inline float configureAndFit(const KdTree& points, FitType& fit, RenderingContext ctx) override {
// Configure computation to be centered on the point cloud coordinates
fit.setWeightFunc(WeightFunc(BaseFitField::params.m_scale));
auto query = points.points()[pointId].pos();
// Compute fit
for (int iter = 0; iter != BaseFitField::params.m_iter; ++iter) {
fit.init(query);
fit.setWeightFunc({query, BaseFitField::params.m_scale});
fit.init();
if (fit.computeWithIds(points.range_neighbors(query, BaseFitField::params.m_scale), points.points()) ==
Ponca::STABLE) {
postProcess(fit);
Expand Down
9 changes: 4 additions & 5 deletions src/drawingPasses/poncaFitField.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct FitField : public BaseFitField {
~FitField() override = default;

using FitType = _FitType;
using WeightFunc = typename FitType::WeightFunction;

/// Method called at the end of the fitting process, only for stable fits
virtual void postProcess(FitType& /*fit*/){};
Expand All @@ -37,10 +36,10 @@ struct FitField : public BaseFitField {

FitType fit;
// Set a weighting function instance
fit.setWeightFunc(WeightFunc(params.m_scale));
fit.setWeightFunc({query, params.m_scale});
// Set the evaluation position
for (int iter = 0; iter != params.m_iter; ++iter) {
fit.init(query);
fit.init();
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(points.range_neighbors(query, params.m_scale), points.points()) ==
Ponca::STABLE) {
Expand Down Expand Up @@ -82,14 +81,14 @@ struct FitField : public BaseFitField {
do {
FitType fit;
// Set a weighting function instance
fit.setWeightFunc(WeightFunc(params.m_scale));
fit.setWeightFunc({x, params.m_scale});

// Set the evaluation position
for (int iter = 0; iter != params.m_iter; ++iter) {
x = nextx;

// project to next location and draw
fit.init(x);
fit.init();
if (fit.computeWithIds(points.range_neighbors(x, params.m_scale), points.points()) ==
Ponca::STABLE) {
postProcess(fit);
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc , char ** argv) {
app->dec_ref();
app->draw_all();
app->set_visible(true);
nanogui::mainloop(1 / 10.f * 1000);
nanogui::run(nanogui::RunMode::VSync);
}

nanogui::shutdown();
Expand Down