Skip to content

Commit

Permalink
Update according to Ponca API change
Browse files Browse the repository at this point in the history
  • Loading branch information
nmellado committed Dec 22, 2023
1 parent 4ebb089 commit eb589f4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/dataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DataManager::savePointCloud(const std::string& path) const{
if( ! file.is_open() ) return false;

file << "# x y nx ny " << "\n";
for( const auto & p : m_tree.point_data() ){
for( const auto & p : m_tree.points() ){
file << p.pos().transpose() << " " << p.normal().transpose() << "\n";
}
file.close();
Expand Down Expand Up @@ -80,7 +80,7 @@ DataManager::computeNormals(int k){
// Set the evaluation position
fit.init(p);
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(m_tree.k_nearest_neighbors(p, k), m_tree.point_data()) == Ponca::STABLE) {
if (fit.computeWithIds(m_tree.k_nearest_neighbors(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 @@ -92,7 +92,7 @@ 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();
auto aabb = m_tree.node_data()[0].getAabb();
auto aabb = m_tree.nodes()[0].getAabb();
if (aabb){
VectorType requestedSize {rangesEnd.first - rangesStart.first, rangesEnd.second - rangesStart.second};
VectorType scaleFactors = requestedSize.array() / aabb->diagonal().array();
Expand Down
2 changes: 1 addition & 1 deletion src/drawingPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct DisplayPoint : public DrawingPass {
const auto pLargeSize = 2.f*m_halfSize;
#pragma omp parallel for default(none) shared(points, buffer, w, h,pLargeSize)
for (int pid = 0; pid< points.point_count(); ++pid){
const auto& p = points.point_data()[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()};
int i (std::floor(p.pos().x()));
Expand Down
8 changes: 4 additions & 4 deletions src/drawingPasses/distanceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
struct DistanceField : public DrawingPass {
inline explicit DistanceField() : DrawingPass() {}
void render(const DataManager::KdTree& points, float*buffer, int w, int h) override {
if(points.point_data().empty())
if(points.points().empty())
{
buffer[1] = ColorMap::NO_FIELD;
return;
Expand All @@ -17,7 +17,7 @@ struct DistanceField : public DrawingPass {
for (int i = 0; i < w; ++i) {
auto *b = buffer + (i + j * w) * 4;
float minDist {float(w*h)}; //distance should necessarily be smaller
for (const auto &p : points.point_data()) {
for (const auto &p : points.points()) {
int u(std::floor(p.pos().x()));
int v(std::floor(p.pos().y()));
auto dist = float(std::sqrt((i-u)*(i-u) + (j-v)*(j-v)));
Expand All @@ -35,7 +35,7 @@ struct DistanceField : public DrawingPass {
struct DistanceFieldWithKdTree : public DrawingPass {
inline explicit DistanceFieldWithKdTree() : DrawingPass() {}
void render(const DataManager::KdTree& points, float*buffer, int w, int h) override{
if(points.point_data().empty())
if(points.points().empty())
{
buffer[1] = ColorMap::NO_FIELD;
return;
Expand All @@ -49,7 +49,7 @@ struct DistanceFieldWithKdTree : public DrawingPass {
DataPoint::VectorType query (i, j);
auto res = points.nearest_neighbor( query );
if(res.begin()!=res.end()) {
auto nei = points.point_data()[res.get()].pos();
auto nei = points.points()[res.get()].pos();
float dist = (nei-query).norm();
b[0] = dist;
b[2] = ColorMap::VALUE_IS_VALID;
Expand Down
4 changes: 2 additions & 2 deletions src/drawingPasses/poncaFitField.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct FitField : public BaseFitField {
virtual void postProcess(FitType& /*fit*/){};

void render(const DataManager::KdTree& points, float*buffer, int w, int h) override{
if(points.point_data().empty()) return;
if(points.points().empty()) return;

float maxVal = 0;
#pragma omp parallel for collapse(2) default(none) shared(points, buffer, w, h) reduction(max : maxVal)
Expand All @@ -38,7 +38,7 @@ struct FitField : public BaseFitField {
for (int iter = 0; iter != m_iter; ++iter) {
fit.init(query);
// Fit plane (method compute handles multipass fitting
if (fit.computeWithIds(points.range_neighbors(query, m_scale), points.point_data()) ==
if (fit.computeWithIds(points.range_neighbors(query, m_scale), points.points()) ==
Ponca::STABLE) {
query = fit.project(query);
}
Expand Down

0 comments on commit eb589f4

Please sign in to comment.