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

Introduce bounding box #199

Merged
merged 11 commits into from
Jul 20, 2023
Merged

Conversation

lucacarniato
Copy link
Contributor

All unit tests green

All unit tests green
libs/MeshKernel/include/MeshKernel/BoundingBox.hpp Outdated Show resolved Hide resolved
Comment on lines 93 to 95
template <typename T>
bool IsContained(T point) const
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, perhaps change to contains.

libs/MeshKernel/include/MeshKernel/BoundingBox.hpp Outdated Show resolved Hide resolved
Comment on lines 345 to 347
RTree m_facesRTree; ///< Spatial R-Tree used to inquire face circumcenters
BoundingBox m_boundingBoxCache; ///< Caches the last bounding box used for selecting the locations

Copy link
Contributor

Choose a reason for hiding this comment

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

Will this caching restrict future threading posibilities
If no threading is planned, then its ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we operate on a single thread. This member will need some protection (mutex) in case of multithreading

Comment on lines 116 to 124
BoundingBox ComputeBoundingBox(UInt i) const
{
std::vector<Point> points;
if (IsEmpty())
{
return BoundingBox(points);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to be something missing.
The point values are not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed function

Comment on lines 49 to 51
/// @param[in] points The point values
/// @returns A tuple with bottom left and upper right corners of the bounding box
template <typename T>
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment is not quite right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

obsolete code

libs/MeshKernel/include/MeshKernel/BoundingBox.hpp Outdated Show resolved Hide resolved
Comment on lines 41 to 45
BoundingBox(const Point& m_lower_left, const Point& m_upper_right)
: m_lowerLeft(m_lower_left),
m_upperRight(m_upper_right)
{
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check that the lower left is really less than the upper right, otherwise throw an exception

Comment on lines +99 to +101

if (nodes[n].x != constants::missing::doubleValue && nodes[n].y != constants::missing::doubleValue)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an IsValid function for points?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Comment on lines 458 to 461
// FindEdgeCloseToAPoint builds m_edgesRTree for searching the edges
mesh->BuildTree(meshkernel::Mesh::Location::Edges);
const size_t index = mesh->FindEdgeCloseToAPoint({1.5, 1.5});
ASSERT_TRUE(static_cast<long long>(index) >= 0); // Luca, need a better test here: ASSERT_EQ(index, actual_closest_edge_index);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any testing of building trees with a bounding box?

Also, are there any specific BB tests, I may have missed them

@lucacarniato lucacarniato marked this pull request as ready for review July 19, 2023 10:12
@lucacarniato lucacarniato requested review from ahmad-el-sayed and removed request for ahmad-el-sayed July 19, 2023 12:19
@lucacarniato lucacarniato merged commit 647102d into master Jul 20, 2023
6 checks passed
@lucacarniato lucacarniato deleted the feature/GRIDEDIT-604_improve_searching branch July 20, 2023 12:19
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