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/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# `CMAKE_BUILD_TYPE` is not required if you are using a multi-configuration generators
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -GNinja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe
cmake -B ${{github.workspace}}/build -GNinja -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_C_COMPILER=cl.exe -DCMAKE_Fortran_COMPILER=""

- name: Build
# Build your program with the given configuration
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10.0)

project("PoncaPlot")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Maybe stop from CMAKEing in the wrong place
Expand Down
2 changes: 1 addition & 1 deletion external/ponca
Submodule ponca updated 250 files
8 changes: 4 additions & 4 deletions src/dataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ DataManager::loadPointCloud(const std::string& path){

void
DataManager::computeNormals(int k){
using WeightFunc = Ponca::DistWeightFunc<DataPoint,Ponca::ConstantWeightKernel<typename DataPoint::Scalar> >;
using WeightFunc = Ponca::DistWeightFilter<DataPoint,Ponca::ConstantWeightKernel<typename DataPoint::Scalar> >;
using PlaneFit = Ponca::Basket<DataPoint ,WeightFunc, Ponca::CovariancePlaneFit>;

std::cout << "Recompute normals" << std::endl;

for (auto& pp : m_points){
VectorType p {pp.x(),pp.y()};
PlaneFit fit;
fit.setWeightFunc({p});
fit.setNeighborFilter({p});
// Set the evaluation position
fit.init();
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(m_tree.k_nearest_neighbors(p, k), m_tree.points()) == Ponca::STABLE) {
if (fit.computeWithIds(m_tree.kNearestNeighbors(p, k), m_tree.points()) == Ponca::STABLE) {
pp.z() = std::acos(fit.primitiveGradient().normalized().x());
} else
std::cerr << "Something weird happened here..." << std::endl;
Expand All @@ -100,7 +100,7 @@ DataManager::computeNormals(int k){
void
DataManager::fitPointCloudToRange(const std::pair<float,float>& rangesEnd, const std::pair<float,float>& rangesStart){
if (m_points.empty()) return;
if (m_tree.node_count() == 0) updateKdTree();
if (m_tree.nodeCount() == 0) updateKdTree();
auto aabb = m_tree.nodes()[0].getAabb();
if (aabb){
VectorType requestedSize {rangesEnd.first - rangesStart.first, rangesEnd.second - rangesStart.second};
Expand Down
3 changes: 1 addition & 2 deletions src/dataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ struct DataManager {

/// Update point collection from point container
inline void updateKdTree() {
if(m_points.empty()) m_tree.clear();
else m_tree.build(m_points );
m_tree.build(m_points );
m_updateFunction();
}

Expand Down
2 changes: 1 addition & 1 deletion src/drawingPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct DisplayPoint : public DrawingPass {
const int scaledHalfSize = ctx.pointToPix(m_halfSize);
const int pLargeSize = 2 * scaledHalfSize;
#pragma omp parallel for default(none) shared(points, buffer, ctx, scaledHalfSize, pLargeSize)
for (int pid = 0; pid< points.point_count(); ++pid){
for (int pid = 0; pid< points.pointCount(); ++pid){
const auto& p = points.points()[pid];
// Build vector that is orthogonal to the normal vector
const VectorType& tangent {p.normal().y(), -p.normal().x()};
Expand Down
12 changes: 6 additions & 6 deletions src/drawingPasses/bestFieldFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
template <typename _FitType, typename _Base>
struct SingleFitField : public _Base {
inline explicit SingleFitField() : _Base() {}
~SingleFitField() override = default;
virtual ~SingleFitField() override = default;

using Base = _Base;
using FitType = _FitType;
using WeightFunc = typename FitType::WeightFunction;
using WeightFunc = typename FitType::NeighborFilter;

virtual float configureAndFit(const KdTree& points, FitType& fit, RenderingContext ctx) = 0;

Expand Down Expand Up @@ -51,7 +51,7 @@ struct SingleFitField : public _Base {
_FitType m_lastFit;
void renderPointsTrajectories(const KdTree& points, float*buffer, RenderingContext ctx) {
#pragma omp parallel for default(none) shared (points, buffer, ctx)
for (int i = 0; i < points.point_count(); ++i) {
for (int i = 0; i < points.pointCount(); ++i) {
const auto& p = points.points()[i];
Base::bresenham(ctx.pointToPix(p.pos()), ctx.pointToPix(m_lastFit.project(p.pos())),{ctx.w, ctx.h},
[buffer, ctx](int x, int y) {
Expand All @@ -78,7 +78,7 @@ struct BestFitField : public SingleFitField<_FitType, DrawingPass> {
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({points.nodes()[0].getAabb()->center(), scale});
fit.setNeighborFilter({points.nodes()[0].getAabb()->center(), scale});
fit.init();
// Compute fit
fit.compute(points.points());
Expand Down Expand Up @@ -115,9 +115,9 @@ struct OnePointFitField : public SingleFitField<_FitType, BaseFitField>, public
auto query = points.points()[pointId].pos();
// Compute fit
for (int iter = 0; iter != BaseFitField::params.m_iter; ++iter) {
fit.setWeightFunc({query, BaseFitField::params.m_scale});
fit.setNeighborFilter({query, BaseFitField::params.m_scale});
fit.init();
if (fit.computeWithIds(points.range_neighbors(query, BaseFitField::params.m_scale), points.points()) ==
if (fit.computeWithIds(points.rangeNeighbors(query, BaseFitField::params.m_scale), points.points()) ==
Ponca::STABLE) {
postProcess(fit);
query = fit.project(query);
Expand Down
2 changes: 1 addition & 1 deletion src/drawingPasses/distanceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct DistanceFieldWithKdTree : public DrawingPass {
auto *b = buffer + (i + j * ctx.w) * 4;
auto coord = ctx.pixToPoint(i,j);
DataPoint::VectorType query (coord.first, coord.second);
auto res = points.nearest_neighbor( query );
auto res = points.nearestNeighbor( query );
if(res.begin()!=res.end()) {
auto nei = points.points()[res.get()].pos();
float dist = (nei-query).norm();
Expand Down
10 changes: 5 additions & 5 deletions src/drawingPasses/poncaFitField.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ struct FitField : public BaseFitField {

FitType fit;
// Set a weighting function instance
fit.setWeightFunc({query, params.m_scale});
fit.setNeighborFilter({query, params.m_scale});
// Set the evaluation position
for (int iter = 0; iter != params.m_iter; ++iter) {
fit.init();
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(points.range_neighbors(query, params.m_scale), points.points()) ==
if (fit.computeWithIds(points.rangeNeighbors(query, params.m_scale), points.points()) ==
Ponca::STABLE) {
query = fit.project(query);
}
Expand All @@ -67,7 +67,7 @@ struct FitField : public BaseFitField {
void renderPointsTrajectories(const KdTree& points, float*buffer, RenderingContext ctx){

#pragma omp parallel for default(none) shared (points, buffer, ctx)
for (int i = 0; i < points.point_count(); ++i)
for (int i = 0; i < points.pointCount(); ++i)
{
const auto& p = points.points()[i];
/// x is going to follow the flow
Expand All @@ -81,15 +81,15 @@ struct FitField : public BaseFitField {
do {
FitType fit;
// Set a weighting function instance
fit.setWeightFunc({x, params.m_scale});
fit.setNeighborFilter({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();
if (fit.computeWithIds(points.range_neighbors(x, params.m_scale), points.points()) ==
if (fit.computeWithIds(points.rangeNeighbors(x, params.m_scale), points.points()) ==
Ponca::STABLE) {
postProcess(fit);
nextx = fit.project(x);
Expand Down
4 changes: 2 additions & 2 deletions src/poncaTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class DataPoint
VectorType m_pos, m_normal;
};

using WeightFunc = Ponca::DistWeightFunc<DataPoint,Ponca::SmoothWeightKernel<typename DataPoint::Scalar> >;
using ConstWeightFunc = Ponca::DistWeightFunc<DataPoint,Ponca::ConstantWeightKernel<typename DataPoint::Scalar> >;
using WeightFunc = Ponca::DistWeightFilter<DataPoint,Ponca::SmoothWeightKernel<typename DataPoint::Scalar> >;
using ConstWeightFunc = Ponca::DistWeightFilter<DataPoint,Ponca::ConstantWeightKernel<typename DataPoint::Scalar> >;

using PlaneFit = Ponca::Basket<DataPoint ,WeightFunc, Ponca::CovariancePlaneFit>;
using ConstPlaneFit = Ponca::Basket<DataPoint ,ConstWeightFunc, Ponca::CovariancePlaneFit>;
Expand Down
Loading