19#include "Base/Math/MathTools.h"
20#include "Base/Tools/DebugMemory.h"
30 for (
int n = 0; n < int(pNodes->size()); n++)
46 for (
int n = 0; n < int(pNodes->size()); n++)
62 for (
int n = 0; n < int(pNodes->size()); n++)
66 position.
fPhi = 360.0f - position.
fPhi;
78 for (
int n = 0; n < int(pNodes->size()); n++)
95 for (
int n = 0; n < int(pNodes->size()); n++)
103 for (
int e = 0; e < int(pEdges->size()); e++)
105 CSGEdge* pEdge = pEdges->at(e);
115 float fMinDistance = FLT_MAX;
116 float fDistance = 0.0f;
119 for (
int n = 0; n < int(pNodes->size()); n++)
121 CSGNode* pNode = pNodes->at(n);
124 if (fDistance < fMinDistance)
126 fMinDistance = fDistance;
139 float fMinDistance = FLT_MAX;
144 for (
int i = 0; i < int(pNodes->size()); i++)
146 for (
int j = 0; j < int(pNodes->size()); j++)
151 pNodes->at(j)->getPosition());
153 if (fDistance < fMinDistance)
155 fMinDistance = fDistance;
172 for (
int e = 0; e < int(pEdges->size()); e++)
174 if ((pEdges->at(e)->nIndex1 == nIndex1) && (pEdges->at(e)->nIndex2 == nIndex2))
179 if ((pEdges->at(e)->nIndex1 == nIndex2) && (pEdges->at(e)->nIndex2 == nIndex1))
202 if (!
getCircumcircle(pGraph, nIndex1, nIndex2, nIndex3, center, fRadius))
207 TSphereCoord point = pNodes->at(nPointIndex)->getPosition();
210 float fDistance = sqrt((center.fPhi - point.
fPhi) * (center.fPhi - point.
fPhi) +
211 (center.fTheta - point.
fTheta) * (center.fTheta - point.
fTheta));
213 bInside = (fDistance < (fRadius + 0.0001));
230 s1 = pNodes->at(nIndex1)->getPosition();
231 s2 = pNodes->at(nIndex2)->getPosition();
232 s3 = pNodes->at(nIndex3)->getPosition();
238 float p1Sq, p2Sq, p3Sq;
248 cx = num / (2.0f * cp);
250 cy = num / (2.0f * cp);
255 fRadius = sqrt((center.fPhi - s1.
fPhi) * (center.fPhi - s1.
fPhi) +
256 (center.fTheta - s1.
fTheta) * (center.fTheta - s1.
fTheta));
270 float fMinRadius = FLT_MAX;
275 for (
int v = 0; v < int(pNodes->size()); v++)
303 if (fRadius < fMinRadius)
305 fMinRadius = fRadius;
317 bool bPresent =
false;
323 if ((*iter) == nIndex2)
std::vector< CSGEdge * > TEdgeList
std::vector< CSGNode * > TNodeList
TSphereCoord getPosition()
void setPosition(TSphereCoord position)
std::vector< int > * getNodeAdjacency(int nIndex)
int addEdge(int nIndex1, int nIndex2)
int addNode(CSGNode *pNode)
virtual CSGNode * getNewNode()
int findClosestNode(CSphericalGraph *pGraph, TSphereCoord coord)
void findClosestNeighbours(CSphericalGraph *pGraph, int &s, int &t)
void inverseTransform(CSphericalGraph *pGraph, TTransform transform)
void copyGraphNodesAndEdges(CSphericalGraph *pSrcGraph, CSphericalGraph *pDstGraph)
bool insideCircumcircle(CSphericalGraph *pGraph, int nIndex1, int nIndex2, int nIndex3, int nPointIndex, bool &bInside)
void invertTheta(CSphericalGraph *pGraph)
int getDelaunayNeighbour(CSphericalGraph *pGraph, CSGEdge *pEdge)
bool getCircumcircle(CSphericalGraph *pGraph, int nIndex1, int nIndex2, int nIndex3, TSphereCoord ¢er, float &fRadius)
void transform(CSphericalGraph *pGraph, TTransform transform)
void invertPhi(CSphericalGraph *pGraph)
bool isEdgePresent(CSphericalGraph *pGraph, int nIndex1, int nIndex2)
int findEdge(CSphericalGraph *pGraph, int nIndex1, int nIndex2)