add const overload for GetPoint

Signed-off-by: Tom Hulton-Harrop <tom.hultonharrop@gmail.com>
This commit is contained in:
Tom Hulton-Harrop 2023-03-30 22:56:46 +01:00
parent a5b0e3cdf4
commit fdefc2f70e

View File

@ -161,6 +161,7 @@ bool constrained_edge[3];
bool delaunay_edge[3]; bool delaunay_edge[3];
Point* GetPoint(int index); Point* GetPoint(int index);
const Point* GetPoint(int index) const;
Point* PointCW(const Point& point); Point* PointCW(const Point& point);
Point* PointCCW(const Point& point); Point* PointCCW(const Point& point);
Point* OppositePoint(Triangle& t, const Point& p); Point* OppositePoint(Triangle& t, const Point& p);
@ -288,11 +289,17 @@ inline Point Cross(double s, const Point& a)
return Point(-s * a.y, s * a.x); return Point(-s * a.y, s * a.x);
} }
inline Point* Triangle::GetPoint(int index) inline const Point* Triangle::GetPoint(int index) const
{ {
return points_[index]; return points_[index];
} }
inline Point* Triangle::GetPoint(int index)
{
return const_cast<Point*>(
static_cast<const Triangle&>(*this).GetPoint(index));
}
inline Triangle* Triangle::GetNeighbor(int index) inline Triangle* Triangle::GetNeighbor(int index)
{ {
return neighbors_[index]; return neighbors_[index];