Merge pull request #1 from Giemsa/definition-refactoring

modify definitions(for more high performance and safety)
This commit is contained in:
Jan Niklas Hasse 2014-01-22 07:38:27 -08:00
commit 21f20031a8
11 changed files with 133 additions and 136 deletions

View File

@ -88,7 +88,7 @@ void Triangle::Clear()
points_[0]=points_[1]=points_[2] = NULL;
}
void Triangle::ClearNeighbor(Triangle *triangle )
void Triangle::ClearNeighbor(const Triangle *triangle )
{
if( neighbors_[0] == triangle )
{
@ -116,7 +116,7 @@ void Triangle::ClearDelunayEdges()
delaunay_edge[0] = delaunay_edge[1] = delaunay_edge[2] = false;
}
Point* Triangle::OppositePoint(Triangle& t, Point& p)
Point* Triangle::OppositePoint(Triangle& t, const Point& p)
{
Point *cw = t.PointCW(p);
return PointCW(*cw);
@ -187,7 +187,7 @@ int Triangle::EdgeIndex(const Point* p1, const Point* p2)
return -1;
}
void Triangle::MarkConstrainedEdge(const int index)
void Triangle::MarkConstrainedEdge(int index)
{
constrained_edge[index] = true;
}
@ -210,7 +210,7 @@ void Triangle::MarkConstrainedEdge(Point* p, Point* q)
}
// The point counter-clockwise to given point
Point* Triangle::PointCW(Point& point)
Point* Triangle::PointCW(const Point& point)
{
if (&point == points_[0]) {
return points_[2];
@ -224,7 +224,7 @@ Point* Triangle::PointCW(Point& point)
}
// The point counter-clockwise to given point
Point* Triangle::PointCCW(Point& point)
Point* Triangle::PointCCW(const Point& point)
{
if (&point == points_[0]) {
return points_[1];
@ -238,7 +238,7 @@ Point* Triangle::PointCCW(Point& point)
}
// The neighbor clockwise to given point
Triangle* Triangle::NeighborCW(Point& point)
Triangle* Triangle::NeighborCW(const Point& point)
{
if (&point == points_[0]) {
return neighbors_[1];
@ -249,7 +249,7 @@ Triangle* Triangle::NeighborCW(Point& point)
}
// The neighbor counter-clockwise to given point
Triangle* Triangle::NeighborCCW(Point& point)
Triangle* Triangle::NeighborCCW(const Point& point)
{
if (&point == points_[0]) {
return neighbors_[2];
@ -259,7 +259,7 @@ Triangle* Triangle::NeighborCCW(Point& point)
return neighbors_[1];
}
bool Triangle::GetConstrainedEdgeCCW(Point& p)
bool Triangle::GetConstrainedEdgeCCW(const Point& p)
{
if (&p == points_[0]) {
return constrained_edge[2];
@ -269,7 +269,7 @@ bool Triangle::GetConstrainedEdgeCCW(Point& p)
return constrained_edge[1];
}
bool Triangle::GetConstrainedEdgeCW(Point& p)
bool Triangle::GetConstrainedEdgeCW(const Point& p)
{
if (&p == points_[0]) {
return constrained_edge[1];
@ -279,7 +279,7 @@ bool Triangle::GetConstrainedEdgeCW(Point& p)
return constrained_edge[0];
}
void Triangle::SetConstrainedEdgeCCW(Point& p, bool ce)
void Triangle::SetConstrainedEdgeCCW(const Point& p, bool ce)
{
if (&p == points_[0]) {
constrained_edge[2] = ce;
@ -290,7 +290,7 @@ void Triangle::SetConstrainedEdgeCCW(Point& p, bool ce)
}
}
void Triangle::SetConstrainedEdgeCW(Point& p, bool ce)
void Triangle::SetConstrainedEdgeCW(const Point& p, bool ce)
{
if (&p == points_[0]) {
constrained_edge[1] = ce;
@ -301,7 +301,7 @@ void Triangle::SetConstrainedEdgeCW(Point& p, bool ce)
}
}
bool Triangle::GetDelunayEdgeCCW(Point& p)
bool Triangle::GetDelunayEdgeCCW(const Point& p)
{
if (&p == points_[0]) {
return delaunay_edge[2];
@ -311,7 +311,7 @@ bool Triangle::GetDelunayEdgeCCW(Point& p)
return delaunay_edge[1];
}
bool Triangle::GetDelunayEdgeCW(Point& p)
bool Triangle::GetDelunayEdgeCW(const Point& p)
{
if (&p == points_[0]) {
return delaunay_edge[1];
@ -321,7 +321,7 @@ bool Triangle::GetDelunayEdgeCW(Point& p)
return delaunay_edge[0];
}
void Triangle::SetDelunayEdgeCCW(Point& p, bool e)
void Triangle::SetDelunayEdgeCCW(const Point& p, bool e)
{
if (&p == points_[0]) {
delaunay_edge[2] = e;
@ -332,7 +332,7 @@ void Triangle::SetDelunayEdgeCCW(Point& p, bool e)
}
}
void Triangle::SetDelunayEdgeCW(Point& p, bool e)
void Triangle::SetDelunayEdgeCW(const Point& p, bool e)
{
if (&p == points_[0]) {
delaunay_edge[1] = e;
@ -344,7 +344,7 @@ void Triangle::SetDelunayEdgeCW(Point& p, bool e)
}
// The neighbor across to given point
Triangle& Triangle::NeighborAcross(Point& opoint)
Triangle& Triangle::NeighborAcross(const Point& opoint)
{
if (&opoint == points_[0]) {
return *neighbors_[0];

View File

@ -111,7 +111,7 @@ struct Point {
/// Convert this point into a unit point. Returns the Length.
double Normalize()
{
double len = Length();
const double len = Length();
x /= len;
y /= len;
return len;
@ -158,50 +158,50 @@ bool constrained_edge[3];
/// Flags to determine if an edge is a Delauney edge
bool delaunay_edge[3];
Point* GetPoint(const int& index);
Point* PointCW(Point& point);
Point* PointCCW(Point& point);
Point* OppositePoint(Triangle& t, Point& p);
Point* GetPoint(int index);
Point* PointCW(const Point& point);
Point* PointCCW(const Point& point);
Point* OppositePoint(Triangle& t, const Point& p);
Triangle* GetNeighbor(const int& index);
Triangle* GetNeighbor(int index);
void MarkNeighbor(Point* p1, Point* p2, Triangle* t);
void MarkNeighbor(Triangle& t);
void MarkConstrainedEdge(const int index);
void MarkConstrainedEdge(int index);
void MarkConstrainedEdge(Edge& edge);
void MarkConstrainedEdge(Point* p, Point* q);
int Index(const Point* p);
int EdgeIndex(const Point* p1, const Point* p2);
Triangle* NeighborCW(Point& point);
Triangle* NeighborCCW(Point& point);
bool GetConstrainedEdgeCCW(Point& p);
bool GetConstrainedEdgeCW(Point& p);
void SetConstrainedEdgeCCW(Point& p, bool ce);
void SetConstrainedEdgeCW(Point& p, bool ce);
bool GetDelunayEdgeCCW(Point& p);
bool GetDelunayEdgeCW(Point& p);
void SetDelunayEdgeCCW(Point& p, bool e);
void SetDelunayEdgeCW(Point& p, bool e);
Triangle* NeighborCW(const Point& point);
Triangle* NeighborCCW(const Point& point);
bool GetConstrainedEdgeCCW(const Point& p);
bool GetConstrainedEdgeCW(const Point& p);
void SetConstrainedEdgeCCW(const Point& p, bool ce);
void SetConstrainedEdgeCW(const Point& p, bool ce);
bool GetDelunayEdgeCCW(const Point& p);
bool GetDelunayEdgeCW(const Point& p);
void SetDelunayEdgeCCW(const Point& p, bool e);
void SetDelunayEdgeCW(const Point& p, bool e);
bool Contains(Point* p);
bool Contains(const Point* p);
bool Contains(const Edge& e);
bool Contains(Point* p, Point* q);
bool Contains(const Point* p, const Point* q);
void Legalize(Point& point);
void Legalize(Point& opoint, Point& npoint);
/**
* Clears all references to all other triangles and points
*/
void Clear();
void ClearNeighbor(Triangle *triangle );
void ClearNeighbor(const Triangle *triangle);
void ClearNeighbors();
void ClearDelunayEdges();
inline bool IsInterior();
inline void IsInterior(bool b);
Triangle& NeighborAcross(Point& opoint);
Triangle& NeighborAcross(const Point& opoint);
void DebugPrint();
@ -278,22 +278,22 @@ inline Point Cross(const Point& a, double s)
/// Perform the cross product on a scalar and a point. In 2D this produces
/// a point.
inline Point Cross(const double s, const Point& a)
inline Point Cross(double s, const Point& a)
{
return Point(-s * a.y, s * a.x);
}
inline Point* Triangle::GetPoint(const int& index)
inline Point* Triangle::GetPoint(int index)
{
return points_[index];
}
inline Triangle* Triangle::GetNeighbor(const int& index)
inline Triangle* Triangle::GetNeighbor(int index)
{
return neighbors_[index];
}
inline bool Triangle::Contains(Point* p)
inline bool Triangle::Contains(const Point* p)
{
return p == points_[0] || p == points_[1] || p == points_[2];
}
@ -303,7 +303,7 @@ inline bool Triangle::Contains(const Edge& e)
return Contains(e.p) && Contains(e.q);
}
inline bool Triangle::Contains(Point* p, Point* q)
inline bool Triangle::Contains(const Point* p, const Point* q)
{
return Contains(p) && Contains(q);
}

View File

@ -56,7 +56,7 @@ enum Orientation { CW, CCW, COLLINEAR };
* = (x1-x3)*(y2-y3) - (y1-y3)*(x2-x3)
* </pre>
*/
Orientation Orient2d(Point& pa, Point& pb, Point& pc)
Orientation Orient2d(const Point& pa, const Point& pb, const Point& pc)
{
double detleft = (pa.x - pc.x) * (pb.y - pc.y);
double detright = (pa.y - pc.y) * (pb.x - pc.x);
@ -103,7 +103,7 @@ bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
*/
bool InScanArea(Point& pa, Point& pb, Point& pc, Point& pd)
bool InScanArea(const Point& pa, const Point& pb, const Point& pc, const Point& pd)
{
double oadb = (pa.x - pb.x)*(pd.y - pb.y) - (pd.x - pb.x)*(pa.y - pb.y);
if (oadb >= -EPSILON) {

View File

@ -39,7 +39,7 @@ AdvancingFront::AdvancingFront(Node& head, Node& tail)
search_node_ = &head;
}
Node* AdvancingFront::LocateNode(const double& x)
Node* AdvancingFront::LocateNode(double x)
{
Node* node = search_node_;
@ -61,7 +61,7 @@ Node* AdvancingFront::LocateNode(const double& x)
return NULL;
}
Node* AdvancingFront::FindSearchNode(const double& x)
Node* AdvancingFront::FindSearchNode(double x)
{
(void)x; // suppress compiler warnings "unused parameter 'x'"
// TODO: implement BST index

View File

@ -74,7 +74,7 @@ Node* search();
void set_search(Node* node);
/// Locate insertion point along advancing front
Node* LocateNode(const double& x);
Node* LocateNode(double x);
Node* LocatePoint(const Point* point);
@ -82,7 +82,7 @@ private:
Node* head_, *tail_, *search_node_;
Node* FindSearchNode(const double& x);
Node* FindSearchNode(double x);
};
inline Node* AdvancingFront::head()

View File

@ -32,13 +32,13 @@
namespace p2t {
CDT::CDT(std::vector<Point*> polyline)
CDT::CDT(const std::vector<Point*>& polyline)
{
sweep_context_ = new SweepContext(polyline);
sweep_ = new Sweep;
}
void CDT::AddHole(std::vector<Point*> polyline)
void CDT::AddHole(const std::vector<Point*>& polyline)
{
sweep_context_->AddHole(polyline);
}

View File

@ -53,7 +53,7 @@ public:
*
* @param polyline
*/
CDT(std::vector<Point*> polyline);
CDT(const std::vector<Point*>& polyline);
/**
* Destructor - clean up memory
@ -65,7 +65,7 @@ public:
*
* @param polyline
*/
void AddHole(std::vector<Point*> polyline);
void AddHole(const std::vector<Point*>& polyline);
/**
* Add a steiner point

View File

@ -161,7 +161,7 @@ void Sweep::EdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* triangl
bool Sweep::IsEdgeSideOfTriangle(Triangle& triangle, Point& ep, Point& eq)
{
int index = triangle.EdgeIndex(&ep, &eq);
const int index = triangle.EdgeIndex(&ep, &eq);
if (index != -1) {
triangle.MarkConstrainedEdge(index);
@ -243,7 +243,7 @@ void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n)
// Fill right basins
if (n.next && n.next->next) {
double angle = BasinAngle(n);
const double angle = BasinAngle(n);
if (angle < PI_3div4) {
FillBasin(tcx, n);
}
@ -251,20 +251,20 @@ void Sweep::FillAdvancingFront(SweepContext& tcx, Node& n)
}
// True if HoleAngle exceeds 90 degrees.
bool Sweep::LargeHole_DontFill(Node* node) {
bool Sweep::LargeHole_DontFill(const Node* node) const {
Node* nextNode = node->next;
Node* prevNode = node->prev;
const Node* nextNode = node->next;
const Node* prevNode = node->prev;
if (!AngleExceeds90Degrees(node->point, nextNode->point, prevNode->point))
return false;
// Check additional points on front.
Node* next2Node = nextNode->next;
const Node* next2Node = nextNode->next;
// "..Plus.." because only want angles on same side as point being added.
if ((next2Node != NULL) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, next2Node->point, prevNode->point))
return false;
Node* prev2Node = prevNode->prev;
const Node* prev2Node = prevNode->prev;
// "..Plus.." because only want angles on same side as point being added.
if ((prev2Node != NULL) && !AngleExceedsPlus90DegreesOrIsNegative(node->point, nextNode->point, prev2Node->point))
return false;
@ -272,19 +272,17 @@ bool Sweep::LargeHole_DontFill(Node* node) {
return true;
}
bool Sweep::AngleExceeds90Degrees(Point* origin, Point* pa, Point* pb) {
double angle = Angle(*origin, *pa, *pb);
bool exceeds90Degrees = ((angle > PI_div2) || (angle < -PI_div2));
return exceeds90Degrees;
bool Sweep::AngleExceeds90Degrees(const Point* origin, const Point* pa, const Point* pb) const {
const double angle = Angle(origin, pa, pb);
return ((angle > PI_div2) || (angle < -PI_div2));
}
bool Sweep::AngleExceedsPlus90DegreesOrIsNegative(Point* origin, Point* pa, Point* pb) {
double angle = Angle(*origin, *pa, *pb);
bool exceedsPlus90DegreesOrIsNegative = (angle > PI_div2) || (angle < 0);
return exceedsPlus90DegreesOrIsNegative;
bool Sweep::AngleExceedsPlus90DegreesOrIsNegative(const Point* origin, const Point* pa, const Point* pb) const {
const double angle = Angle(origin, pa, pb);
return (angle > PI_div2) || (angle < 0);
}
double Sweep::Angle(Point& origin, Point& pa, Point& pb) {
double Sweep::Angle(const Point* origin, const Point* pa, const Point* pb) const {
/* Complex plane
* ab = cosA +i*sinA
* ab = (ax + ay*i)(bx + by*i) = (ax*bx + ay*by) + i(ax*by-ay*bx)
@ -293,26 +291,25 @@ double Sweep::Angle(Point& origin, Point& pa, Point& pb) {
* Where x = ax*bx + ay*by
* y = ax*by - ay*bx
*/
double px = origin.x;
double py = origin.y;
double ax = pa.x- px;
double ay = pa.y - py;
double bx = pb.x - px;
double by = pb.y - py;
double x = ax * by - ay * bx;
double y = ax * bx + ay * by;
double angle = atan2(x, y);
return angle;
const double px = origin->x;
const double py = origin->y;
const double ax = pa->x- px;
const double ay = pa->y - py;
const double bx = pb->x - px;
const double by = pb->y - py;
const double x = ax * by - ay * bx;
const double y = ax * bx + ay * by;
return atan2(x, y);
}
double Sweep::BasinAngle(Node& node)
double Sweep::BasinAngle(const Node& node) const
{
double ax = node.point->x - node.next->next->point->x;
double ay = node.point->y - node.next->next->point->y;
const double ax = node.point->x - node.next->next->point->x;
const double ay = node.point->y - node.next->next->point->y;
return atan2(ay, ax);
}
double Sweep::HoleAngle(Node& node)
double Sweep::HoleAngle(const Node& node) const
{
/* Complex plane
* ab = cosA +i*sinA
@ -322,10 +319,10 @@ double Sweep::HoleAngle(Node& node)
* Where x = ax*bx + ay*by
* y = ax*by - ay*bx
*/
double ax = node.next->point->x - node.point->x;
double ay = node.next->point->y - node.point->y;
double bx = node.prev->point->x - node.point->x;
double by = node.prev->point->y - node.point->y;
const double ax = node.next->point->x - node.point->x;
const double ay = node.next->point->y - node.point->y;
const double bx = node.prev->point->x - node.point->x;
const double by = node.prev->point->y - node.point->y;
return atan2(ax * by - ay * bx, ax * bx + ay * by);
}
@ -390,43 +387,43 @@ bool Sweep::Legalize(SweepContext& tcx, Triangle& t)
return false;
}
bool Sweep::Incircle(Point& pa, Point& pb, Point& pc, Point& pd)
bool Sweep::Incircle(const Point& pa, const Point& pb, const Point& pc, const Point& pd) const
{
double adx = pa.x - pd.x;
double ady = pa.y - pd.y;
double bdx = pb.x - pd.x;
double bdy = pb.y - pd.y;
const double adx = pa.x - pd.x;
const double ady = pa.y - pd.y;
const double bdx = pb.x - pd.x;
const double bdy = pb.y - pd.y;
double adxbdy = adx * bdy;
double bdxady = bdx * ady;
double oabd = adxbdy - bdxady;
const double adxbdy = adx * bdy;
const double bdxady = bdx * ady;
const double oabd = adxbdy - bdxady;
if (oabd <= 0)
return false;
double cdx = pc.x - pd.x;
double cdy = pc.y - pd.y;
const double cdx = pc.x - pd.x;
const double cdy = pc.y - pd.y;
double cdxady = cdx * ady;
double adxcdy = adx * cdy;
double ocad = cdxady - adxcdy;
const double cdxady = cdx * ady;
const double adxcdy = adx * cdy;
const double ocad = cdxady - adxcdy;
if (ocad <= 0)
return false;
double bdxcdy = bdx * cdy;
double cdxbdy = cdx * bdy;
const double bdxcdy = bdx * cdy;
const double cdxbdy = cdx * bdy;
double alift = adx * adx + ady * ady;
double blift = bdx * bdx + bdy * bdy;
double clift = cdx * cdx + cdy * cdy;
const double alift = adx * adx + ady * ady;
const double blift = bdx * bdx + bdy * bdy;
const double clift = cdx * cdx + cdy * cdy;
double det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd;
const double det = alift * (bdxcdy - cdxbdy) + blift * ocad + clift * oabd;
return det > 0;
}
void Sweep::RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op)
void Sweep::RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op) const
{
Triangle* n1, *n2, *n3, *n4;
n1 = t.NeighborCCW(p);

View File

@ -142,7 +142,7 @@ private:
* @param d - point opposite a
* @return true if d is inside circle, false if on circle edge
*/
bool Incircle(Point& pa, Point& pb, Point& pc, Point& pd);
bool Incircle(const Point& pa, const Point& pb, const Point& pc, const Point& pd) const;
/**
* Rotates a triangle pair one vertex CW
@ -158,7 +158,7 @@ private:
* n4 n4
* </pre>
*/
void RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op);
void RotateTrianglePair(Triangle& t, Point& p, Triangle& ot, Point& op) const;
/**
* Fills holes in the Advancing Front
@ -171,22 +171,22 @@ private:
// Decision-making about when to Fill hole.
// Contributed by ToolmakerSteve2
bool LargeHole_DontFill(Node* node);
bool AngleExceeds90Degrees(Point* origin, Point* pa, Point* pb);
bool AngleExceedsPlus90DegreesOrIsNegative(Point* origin, Point* pa, Point* pb);
double Angle(Point& origin, Point& pa, Point& pb);
bool LargeHole_DontFill(const Node* node) const;
bool AngleExceeds90Degrees(const Point* origin, const Point* pa, const Point* pb) const;
bool AngleExceedsPlus90DegreesOrIsNegative(const Point* origin, const Point* pa, const Point* pb) const;
double Angle(const Point* origin, const Point* pa, const Point* pb) const;
/**
*
* @param node - middle node
* @return the angle between 3 front nodes
*/
double HoleAngle(Node& node);
double HoleAngle(const Node& node) const;
/**
* The basin angle is decided against the horizontal line [1,0]
*/
double BasinAngle(Node& node);
double BasinAngle(const Node& node) const;
/**
* Fills a basin that has formed on the Advancing Front to the right

View File

@ -34,7 +34,7 @@
namespace p2t {
SweepContext::SweepContext(std::vector<Point*> polyline) : points_(polyline),
SweepContext::SweepContext(const std::vector<Point*>& polyline) : points_(polyline),
front_(0),
head_(0),
tail_(0),
@ -45,7 +45,7 @@ SweepContext::SweepContext(std::vector<Point*> polyline) : points_(polyline),
InitEdges(points_);
}
void SweepContext::AddHole(std::vector<Point*> polyline)
void SweepContext::AddHole(const std::vector<Point*>& polyline)
{
InitEdges(polyline);
for(unsigned int i = 0; i < polyline.size(); i++) {
@ -57,12 +57,12 @@ void SweepContext::AddPoint(Point* point) {
points_.push_back(point);
}
std::vector<Triangle*> SweepContext::GetTriangles()
std::vector<Triangle*> &SweepContext::GetTriangles()
{
return triangles_;
}
std::list<Triangle*> SweepContext::GetMap()
std::list<Triangle*> &SweepContext::GetMap()
{
return map_;
}
@ -95,7 +95,7 @@ void SweepContext::InitTriangulation()
}
void SweepContext::InitEdges(std::vector<Point*> polyline)
void SweepContext::InitEdges(const std::vector<Point*>& polyline)
{
size_t num_points = polyline.size();
for (size_t i = 0; i < num_points; i++) {
@ -114,13 +114,13 @@ void SweepContext::AddToMap(Triangle* triangle)
map_.push_back(triangle);
}
Node& SweepContext::LocateNode(Point& point)
Node& SweepContext::LocateNode(const Point& point)
{
// TODO implement search tree
return *front_->LocateNode(point.x);
}
void SweepContext::CreateAdvancingFront(std::vector<Node*> nodes)
void SweepContext::CreateAdvancingFront(const std::vector<Node*>& nodes)
{
(void) nodes;

View File

@ -52,25 +52,25 @@ class SweepContext {
public:
/// Constructor
SweepContext(std::vector<Point*> polyline);
SweepContext(const std::vector<Point*>& polyline);
/// Destructor
~SweepContext();
void set_head(Point* p1);
Point* head();
Point* head() const;
void set_tail(Point* p1);
Point* tail();
Point* tail() const;
size_t point_count();
size_t point_count() const;
Node& LocateNode(Point& point);
Node& LocateNode(const Point& point);
void RemoveNode(Node* node);
void CreateAdvancingFront(std::vector<Node*> nodes);
void CreateAdvancingFront(const std::vector<Node*>& nodes);
/// Try to map a node to all sides of this triangle that don't have a neighbor
void MapTriangleToNodes(Triangle& t);
@ -83,16 +83,16 @@ Point* GetPoints();
void RemoveFromMap(Triangle* triangle);
void AddHole(std::vector<Point*> polyline);
void AddHole(const std::vector<Point*>& polyline);
void AddPoint(Point* point);
AdvancingFront* front();
AdvancingFront* front() const;
void MeshClean(Triangle& triangle);
std::vector<Triangle*> GetTriangles();
std::list<Triangle*> GetMap();
std::vector<Triangle*> &GetTriangles();
std::list<Triangle*> &GetMap();
std::vector<Edge*> edge_list;
@ -147,16 +147,16 @@ Point* tail_;
Node *af_head_, *af_middle_, *af_tail_;
void InitTriangulation();
void InitEdges(std::vector<Point*> polyline);
void InitEdges(const std::vector<Point*>& polyline);
};
inline AdvancingFront* SweepContext::front()
inline AdvancingFront* SweepContext::front() const
{
return front_;
}
inline size_t SweepContext::point_count()
inline size_t SweepContext::point_count() const
{
return points_.size();
}
@ -166,7 +166,7 @@ inline void SweepContext::set_head(Point* p1)
head_ = p1;
}
inline Point* SweepContext::head()
inline Point* SweepContext::head() const
{
return head_;
}
@ -176,7 +176,7 @@ inline void SweepContext::set_tail(Point* p1)
tail_ = p1;
}
inline Point* SweepContext::tail()
inline Point* SweepContext::tail() const
{
return tail_;
}