# Fixed DCDT compile errors on GCC.

This was SVN commit r5405.
This commit is contained in:
Matei 2007-10-11 07:54:52 +00:00
parent 025ead5b69
commit fa0a07cdab
7 changed files with 28 additions and 27 deletions

View File

@ -245,9 +245,9 @@ void FunnelDeque::Add(const SrPnt2& p, CornerType type, SrPolygon& path)
//move the apex to the right and add the segment between
//the old and new apexes to the path so far
float angle = Angle(m_CApex->X(), m_CApex->Y(), m_tApexType,
m_CApex->Right()->X(), m_CApex->Right()->Y(), CornerType::LeftTangent);
m_CApex->Right()->X(), m_CApex->Right()->Y(), LeftTangent);
AddPoint(m_CApex->X(), m_CApex->Y(), m_tApexType, angle, path);
AddPoint(m_CApex->Right()->X(), m_CApex->Right()->Y(), CornerType::LeftTangent, angle, path);
AddPoint(m_CApex->Right()->X(), m_CApex->Right()->Y(), LeftTangent, angle, path);
m_CApex = m_CApex->Right();
m_tApexType = LeftTangent;
}
@ -344,9 +344,9 @@ void FunnelDeque::Add(const SrPnt2& p, CornerType type, SrPolygon& path)
else
{
float angle = Angle(m_CApex->X(), m_CApex->Y(), m_tApexType,
m_CApex->Left()->X(), m_CApex->Left()->Y(), CornerType::RightTangent);
m_CApex->Left()->X(), m_CApex->Left()->Y(), RightTangent);
AddPoint(m_CApex->X(), m_CApex->Y(), m_tApexType, angle, path);
AddPoint(m_CApex->Left()->X(), m_CApex->Left()->Y(), CornerType::RightTangent, angle, path);
AddPoint(m_CApex->Left()->X(), m_CApex->Left()->Y(), RightTangent, angle, path);
m_CApex = m_CApex->Left();
m_tApexType = RightTangent;
}
@ -375,8 +375,8 @@ void FunnelDeque::Add(const SrPnt2& p, CornerType type, SrPolygon& path)
{
float x_1, y_1, x_2, y_2, toPoint;
CornerType type_1, type_2;
type_1 = (Current == m_CApex) ? m_tApexType : CornerType::LeftTangent;
type_2 = (Current->Right() == m_CRight) ? CornerType::Point : CornerType::LeftTangent;
type_1 = (Current == m_CApex) ? m_tApexType : LeftTangent;
type_2 = (Current->Right() == m_CRight) ? Point : LeftTangent;
x_1 = Current->X();
y_1 = Current->Y();
Current = Current->Right();

View File

@ -625,14 +625,14 @@ bool SeDcdt::SearchPathFast(float x1, float y1, float x2, float y2, float r)//,
//find the triangle containing the start point
SeTriangulator::LocateResult startResult = LocatePoint(x1, y1, start);
//if it wasn't found, return a path could not be found
if (startResult == SeTriangulator::LocateResult::NotFound)
if (startResult == SeTriangulator::NotFound)
{
return false;
}
//find the triangle containing the goal point
SeTriangulator::LocateResult goalResult = LocatePoint(x2, y2, goal);
//if it couldn't, return a failure
if (goalResult == SeTriangulator::LocateResult::NotFound)
if (goalResult == SeTriangulator::NotFound)
{
return false;
}
@ -1793,7 +1793,7 @@ bool SeDcdt::SearchPathBaseFast(float x1, float y1, float x2, float y2, float r)
//find the triangle containing the start point
SeTriangulator::LocateResult startResult = LocatePoint(x1, y1, start);
//if it wasn't found, return a path could not be found
if (startResult == SeTriangulator::LocateResult::NotFound)
if (startResult == SeTriangulator::NotFound)
{
return false;
}
@ -2179,14 +2179,14 @@ float SeDcdt::GetShortestPath(SrPolygon &path, SrArray<SeBase *> Channel, float
SrPnt2 p;
p.set(((SeDcdtVertex *)s->vtx())->p);
//insert it into the deque
fd.Add(p, FunnelDeque::CornerType::LeftTangent, path);
fd.Add(p, FunnelDeque::LeftTangent, path);
SeVertex *right = s->vtx();
//get the point on the left side of that edge
s = s->nxt();
SeVertex *left = s->vtx();
p.set(((SeDcdtVertex *)s->vtx())->p);
//insert it into the deque
fd.Add(p, FunnelDeque::CornerType::RightTangent, path);
fd.Add(p, FunnelDeque::RightTangent, path);
//go through the other edges in the channel
for (int i = 1; i < Channel.size() - 1; i++)
{
@ -2207,14 +2207,14 @@ float SeDcdt::GetShortestPath(SrPolygon &path, SrArray<SeBase *> Channel, float
if (s->vtx() == right)
{
p.set(((SeDcdtVertex *)s->nxt()->vtx())->p);
fd.Add(p, FunnelDeque::CornerType::RightTangent, path);
fd.Add(p, FunnelDeque::RightTangent, path);
left = s->nxt()->vtx();
}
//otherwise, add it to the right side of the funnel
else //(s->nxt()->vtx() == left)
{
p.set(((SeDcdtVertex *)s->vtx())->p);
fd.Add(p, FunnelDeque::CornerType::LeftTangent, path);
fd.Add(p, FunnelDeque::LeftTangent, path);
right = s->vtx();
}
}
@ -2235,16 +2235,16 @@ float SeDcdt::GetShortestPath(SrPolygon &path, SrArray<SeBase *> Channel, float
if (s->vtx() == right)
{
p.set(((SeDcdtVertex *)s->nxt()->vtx())->p);
fd.Add(p, FunnelDeque::CornerType::RightTangent, path);
fd.Add(p, FunnelDeque::RightTangent, path);
}
else //(s->nxt()->vtx() == left)
{
p.set(((SeDcdtVertex *)s->vtx())->p);
fd.Add(p, FunnelDeque::CornerType::LeftTangent, path);
fd.Add(p, FunnelDeque::LeftTangent, path);
}
//finally, add the goal point to the funnel
p.set(x2, y2);
fd.Add(p, FunnelDeque::CornerType::Point, path);
fd.Add(p, FunnelDeque::Point, path);
//calculate the length of the path sand return it
return fd.Length(path);
}

View File

@ -27,7 +27,7 @@ class SrCfgNode
int _parentlink;
struct Link { SrCfgNode* node; float dist; int level; };
SrArray<Link> _children;
friend SrCfgTreeBase;
friend class SrCfgTreeBase;
public :
SrCfgNode* parent () const { return _parent; }
int parentlink () const { return _parentlink; } // -1 if root node

View File

@ -157,7 +157,7 @@ class SrGrid : public SrGridBase
/*! Returns the cell of given n-D coordinates */
X& operator() ( const SrArray<int>& coords )
{ return _data[SrGridBase::cell_index(i,j)]; }
{ return _data[SrGridBase::cell_index(coords)]; }
};
//============================== end of file ===============================

View File

@ -6,6 +6,7 @@
# define SR_HASH_TABLE_H
# include "sr_array.h"
# include "sr_shared_class.h"
//================================ SrHashTableBase ===============================

View File

@ -169,20 +169,20 @@ class SrSnSharedShape : public SrSnShape<X>
{ public :
/*! Constructor receives a pointer to a shape. If the pointer is null,
a new shape will be allocated and used. */
SrSnSharedShape ( X* pt=0 ) : SrSnShape<X> (pt) { _data->ref(); }
SrSnSharedShape ( X* pt=0 ) : SrSnShape<X> (pt) { this->_data->ref(); }
/* Virtual Destructor .*/
virtual ~SrSnSharedShape ()
{ _data->unref();
_data=0; // to cope with base class destructor
{ this->_data->unref();
this->_data=0; // to cope with base class destructor
}
/*! Reference a new shape, and unreference the old one. */
void shape ( X* pt ) { changed(true); _data->unref(); _data=pt; _data->ref(); }
void shape ( X* pt ) { this->changed(true); this->_data->unref(); this->_data=pt; this->_data->ref(); }
/*! Get a reference to the shape data, and sets the state of the node
as changed, implying that display lists should be regenerated. */
X& shape () { changed(true); return *_data; }
X& shape () { this->changed(true); return *this->_data; }
};
class SrModel;

View File

@ -15,7 +15,7 @@ class SrVtx
double _x, _y;
int _id;
private :
friend SrTriangulation;
friend class SrTriangulation;
void set ( double x, double y, int id ) { _x=x; _y=y; _id=id; }
public :
double x() const { return _x; }
@ -34,8 +34,8 @@ class SrTri
char _mark[3]; // Used for marking traversal elements
int _id;
private :
friend SrTravel;
friend SrTriangulation;
friend class SrTravel;
friend class SrTriangulation;
void set ( SrVtx* v0, SrVtx* v1, SrVtx* v2, SrTri* t0, SrTri* t1, SrTri* t2, int id );
int sideindex ( int i );
@ -55,7 +55,7 @@ class SrTravel
{ private :
SrTri* _t; // the referenced triangle
int _v; // the referenced vertex id of the triangle
friend SrTriangulation;
friend class SrTriangulation;
public :
SrTravel () : _t(0), _v(0) {}