Skip to content
Snippets Groups Projects
Commit 233ad6ff authored by Tom Fischer's avatar Tom Fischer
Browse files

Renamed method isPntInBV() and private attribute.

Renamed
- from isPntInBV() to isPntInBoundingVolume() and
- from _bv to _bounding_volume
to make the code more readable.
parent b19b37e3
No related branches found
No related tags found
No related merge requests found
......@@ -29,14 +29,14 @@
namespace GeoLib
{
Surface::Surface (const std::vector<Point*> &pnt_vec) :
GeoObject(), _sfc_pnts(pnt_vec), _bv(nullptr)
GeoObject(), _sfc_pnts(pnt_vec), _bounding_volume(nullptr)
{}
Surface::~Surface ()
{
for (std::size_t k(0); k < _sfc_triangles.size(); k++)
delete _sfc_triangles[k];
delete _bv;
delete _bounding_volume;
}
void Surface::addTriangle (std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
......@@ -48,16 +48,16 @@ void Surface::addTriangle (std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt
return;
_sfc_triangles.push_back (new Triangle(_sfc_pnts, pnt_a, pnt_b, pnt_c));
if (!_bv) {
if (!_bounding_volume) {
std::vector<size_t> ids(3);
ids[0] = pnt_a;
ids[1] = pnt_b;
ids[2] = pnt_c;
_bv = new AABB<Point>(_sfc_pnts, ids);
_bounding_volume = new AABB<Point>(_sfc_pnts, ids);
} else {
_bv->update (*_sfc_pnts[pnt_a]);
_bv->update (*_sfc_pnts[pnt_b]);
_bv->update (*_sfc_pnts[pnt_c]);
_bounding_volume->update (*_sfc_pnts[pnt_a]);
_bounding_volume->update (*_sfc_pnts[pnt_b]);
_bounding_volume->update (*_sfc_pnts[pnt_c]);
}
}
......@@ -112,9 +112,9 @@ const Triangle* Surface::operator[] (std::size_t i) const
return _sfc_triangles[i];
}
bool Surface::isPntInBV (const double *pnt) const
bool Surface::isPntInBoundingVolume(const double *pnt) const
{
return _bv->containsPoint (pnt);
return _bounding_volume->containsPoint (pnt);
}
bool Surface::isPntInSfc (const double *pnt) const
......
......@@ -58,7 +58,7 @@ public:
/**
* is the given point in the bounding volume of the surface
*/
bool isPntInBV (const double *pnt) const;
bool isPntInBoundingVolume(const double *pnt) const;
/**
* is the given point pnt located in the surface
......@@ -73,7 +73,7 @@ public:
* method allows access to the internal axis aligned bounding box
* @return axis aligned bounding box
*/
AABB<GeoLib::Point> const& getAABB () const { return *_bv; }
AABB<GeoLib::Point> const& getAABB () const { return *_bounding_volume; }
protected:
/** a vector of pointers to Points */
......@@ -81,7 +81,7 @@ protected:
/** position of pointers to the geometric points */
std::vector<Triangle*> _sfc_triangles;
/** bounding volume is an axis aligned bounding box */
AABB<GeoLib::Point> *_bv;
AABB<GeoLib::Point> *_bounding_volume;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment