Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments to https://github.com/GabijaBern/raycloudtools/tree/new_command_line_params #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thomas-lowe
Copy link
Collaborator

The new_command_line_params changes are implemented a bit differently here, so this is instead of that branch.

  1. --radius_min added, this is changed to calculate radius at the end, which is with an estimated global taper included, more accurate.
  2. --grid_origin 0,0 added, changed to a vector2 as it only supports horizontal gridding and modified to allow you it to be either the location of the nearest grid vertex (e.g. 0,0 for a vertex-origin grid) or the corner location of the grid (e.g. -1039.6, -16.7). This allows users who have made an overlapping grid of arbitrary translation to pass in that grid origin position. The material difference is that you will need to use the negative of any value you used previously. Since this is an advanced option I put it in the advanced commandline settings, where you go to the code to read the description. The reason for this is that --grid_origin is incompatible with raysplit grid, so only use it if you are using an external tool for gridding the clouds.
  3. ifs.fail() is now a better error message, hopefully this fits with what you need.

@@ -29,7 +29,7 @@ bool readLas(const std::string &file_name,

if (ifs.fail())
{
std::cerr << "readLas: failed to open stream" << std::endl;
std::cerr << "readLas: failed to open file " << file_name << ", error: " << std::strerror(errno) << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not certain this error will inform if file does not exist.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does. Just tested it.
"readLas: failed to open file doesnottexist.blh, error: No such file or directory"

@@ -283,6 +285,10 @@ Trees::Trees(Cloud &cloud, const Eigen::Vector3d &offset, const Mesh &mesh, cons
removeOutOfBoundSections(cloud, min_bound, max_bound, offset);
}

if (params_->radius_min > 0.0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious to understand the code a little bit better. If I run this approach, will it break the algorithm? What does bifurcate() method do?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeSmallRadiusTrees() is called towards the end when the radius() function will be accurate. We can't filter based on estimated_radius because this is not the final estimation, just an initial estimate.

bifurcate() is a function for splitting a segment at a tree branching point, so it adds to segments (cylinders) to the list, the key line being: sections_.push_back(new_node); Usually it is just a split in two, but it may also split into multiple branches.

@GabijaBern
Copy link
Collaborator

Hey, I am actually taking another look at all of this, I had little time and pushed non-working code. I am going to take your ideas and revisit my PR.

@thomas-lowe
Copy link
Collaborator Author

thomas-lowe commented Nov 20, 2024 via email

Eigen::Vector2d mid_local(mid[0], mid[1]);
mid_local -= params_->grid_origin;
const Eigen::Vector2d inds(std::floor(mid_local[0] / width), std::floor(mid_local[1] / width));
min_bound[0] = width * (inds[0]) + params_->grid_origin[0] - offset[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am understanding your implementation correctly, you don't need to add the params_->grid_origin[0], for subsequent calls as well, otherwise, you remove the grid origin shift?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it is: grid_origin + snap_to_grid(mid - grid_origin)
which means snapping to an offset grid.
I've tested it on simple cases and seems to work.

max_bound[0] = width * (inds[0] + 0.5) - offset[0];
max_bound[1] = width * (inds[1] + 0.5) - offset[1];
Eigen::Vector2d mid_local(mid[0], mid[1]);
mid_local -= params_->grid_origin;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And shouldn't this be mid_local +=?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically it is: grid_origin + snap_to_grid(mid - grid_origin)
which means snapping to an offset grid.
I've tested it on simple cases and seems to work.

The '-d' treads on the distance_limit param, so I had to change it to -j in my PR. One reason why I like to minimise command line parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants