mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-12-02 02:03:30 +01:00
add const overload and return by reference
Signed-off-by: Tom Hulton-Harrop <tom.hultonharrop@gmail.com>
This commit is contained in:
parent
81612cb108
commit
a5b0e3cdf4
@ -52,12 +52,12 @@ void CDT::Triangulate()
|
||||
sweep_->Triangulate(*sweep_context_);
|
||||
}
|
||||
|
||||
std::vector<p2t::Triangle*> CDT::GetTriangles()
|
||||
const std::vector<p2t::Triangle*>& CDT::GetTriangles() const
|
||||
{
|
||||
return sweep_context_->GetTriangles();
|
||||
}
|
||||
|
||||
std::list<p2t::Triangle*> CDT::GetMap()
|
||||
const std::list<p2t::Triangle*>& CDT::GetMap() const
|
||||
{
|
||||
return sweep_context_->GetMap();
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public:
|
||||
/**
|
||||
* Get CDT triangles
|
||||
*/
|
||||
std::vector<Triangle*> GetTriangles();
|
||||
const std::vector<Triangle*>& GetTriangles() const;
|
||||
|
||||
/**
|
||||
* Get triangle map
|
||||
*/
|
||||
std::list<Triangle*> GetMap();
|
||||
const std::list<Triangle*>& GetMap() const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -58,11 +58,23 @@ void SweepContext::AddPoint(Point* point) {
|
||||
}
|
||||
|
||||
std::vector<Triangle*>& SweepContext::GetTriangles()
|
||||
{
|
||||
return const_cast<std::vector<Triangle*>&>(
|
||||
static_cast<const SweepContext&>(*this).GetTriangles());
|
||||
}
|
||||
|
||||
const std::vector<Triangle*>& SweepContext::GetTriangles() const
|
||||
{
|
||||
return triangles_;
|
||||
}
|
||||
|
||||
std::list<Triangle*>& SweepContext::GetMap()
|
||||
{
|
||||
return const_cast<std::list<Triangle*>&>(
|
||||
static_cast<const SweepContext&>(*this).GetMap());
|
||||
}
|
||||
|
||||
const std::list<Triangle*>& SweepContext::GetMap() const
|
||||
{
|
||||
return map_;
|
||||
}
|
||||
|
@ -91,7 +91,9 @@ AdvancingFront* front() const;
|
||||
void MeshClean(Triangle& triangle);
|
||||
|
||||
std::vector<Triangle*> &GetTriangles();
|
||||
const std::vector<Triangle*> &GetTriangles() const;
|
||||
std::list<Triangle*> &GetMap();
|
||||
const std::list<Triangle*> &GetMap() const;
|
||||
|
||||
std::vector<Edge*> edge_list;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user