Skip to content

Commit

Permalink
Added new function contains in Boundary. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 290a289 commit ae51616
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/geom/Boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ Boundary::crosses(const Position& p1, const Position& p2) const {
}


double
Boundary::contains(const Boundary& b) const {
if ((myXmin >= b.xmin()) && (myYmin >= b.ymin()) &&
(myXmax <= b.xmax()) && (myYmax <= b.ymax())) {
return true;
} else {
return false;
}
}


bool
Boundary::isInitialised() const {
return myWasInitialised;
Expand Down
5 changes: 5 additions & 0 deletions src/utils/geom/Boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Boundary : public AbstractPoly {

/// @name inherited from AbstractPoly
/// @{

/// @brief Returns whether the boundary contains the given coordinate
bool around(const Position& p, double offset = 0) const;

Expand All @@ -105,8 +106,12 @@ class Boundary : public AbstractPoly {

/// @brief Returns whether the boundary crosses the given line
bool crosses(const Position& p1, const Position& p2) const;

/// @}

/// @brief return true if this boundary contains the given boundary (only X-Y)
double contains(const Boundary& b) const;

/// @brief check if Boundary is Initialised
bool isInitialised() const;

Expand Down

0 comments on commit ae51616

Please sign in to comment.