mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-12-02 10:13:29 +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_);
|
sweep_->Triangulate(*sweep_context_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<p2t::Triangle*> CDT::GetTriangles()
|
const std::vector<p2t::Triangle*>& CDT::GetTriangles() const
|
||||||
{
|
{
|
||||||
return sweep_context_->GetTriangles();
|
return sweep_context_->GetTriangles();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<p2t::Triangle*> CDT::GetMap()
|
const std::list<p2t::Triangle*>& CDT::GetMap() const
|
||||||
{
|
{
|
||||||
return sweep_context_->GetMap();
|
return sweep_context_->GetMap();
|
||||||
}
|
}
|
||||||
|
@ -83,12 +83,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get CDT triangles
|
* Get CDT triangles
|
||||||
*/
|
*/
|
||||||
std::vector<Triangle*> GetTriangles();
|
const std::vector<Triangle*>& GetTriangles() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get triangle map
|
* Get triangle map
|
||||||
*/
|
*/
|
||||||
std::list<Triangle*> GetMap();
|
const std::list<Triangle*>& GetMap() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -58,11 +58,23 @@ void SweepContext::AddPoint(Point* point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Triangle*>& SweepContext::GetTriangles()
|
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_;
|
return triangles_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<Triangle*>& SweepContext::GetMap()
|
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_;
|
return map_;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,9 @@ AdvancingFront* front() const;
|
|||||||
void MeshClean(Triangle& triangle);
|
void MeshClean(Triangle& triangle);
|
||||||
|
|
||||||
std::vector<Triangle*> &GetTriangles();
|
std::vector<Triangle*> &GetTriangles();
|
||||||
|
const std::vector<Triangle*> &GetTriangles() const;
|
||||||
std::list<Triangle*> &GetMap();
|
std::list<Triangle*> &GetMap();
|
||||||
|
const std::list<Triangle*> &GetMap() const;
|
||||||
|
|
||||||
std::vector<Edge*> edge_list;
|
std::vector<Edge*> edge_list;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user