Skip to content

Commit

Permalink
Restore a function that was actually used by the matlab binding
Browse files Browse the repository at this point in the history
  • Loading branch information
rjanvier committed Feb 5, 2024
1 parent 68bf852 commit 7b69e06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/CSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ void CSF::setPointCloud(double *points, int rows, int cols) {
}
}



void CSF::setPointCloud(double *points, int rows) {
#define Mat(i, j) points[i + j * rows]
point_cloud.resize(rows);
for (int i = 0; i < rows; i++) {
point_cloud[i] = {Mat(i, 0), -Mat(i, 2) , Mat(i, 1)};
}
}

void CSF::setPointCloud(csf::PointCloud& pc) {
point_cloud.resize(pc.size());
int pointCount = static_cast<int>(pc.size());
Expand Down
7 changes: 6 additions & 1 deletion src/CSF.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ class CSF

// set pointcloud from vector
void setPointCloud(std::vector<csf::Point> points);
// set point cloud from a one-dimentional array. it defines a N*3 point cloud by the given rows.

// set point cloud from a two-dimentional array. it defines a N*3 point cloud by the given rows.
// it is the method used to set point cloud from python (numpy array)
void setPointCloud(double *points, int rows, int cols);

// set point cloud from a one-dimentional array. it defines a N*3 point cloud by the given rows.
// it is the method used to set point cloud from matlab
void setPointCloud(double *points, int rows);

// read pointcloud from txt file: (X Y Z) for each line
void readPointsFromFile(std::string filename);
Expand Down

0 comments on commit 7b69e06

Please sign in to comment.