Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 30 August 2005 - 09:14 AM
Posted 31 August 2005 - 08:37 AM
for (unsigned int i=0; i<mNodeCount-2; i++)
{
for (unsigned int j=i+1; j<mNodeCount-1; j++)
{
for (unsigned int k=j+1; k<mNodeCount; k++)
{
if (!c.CircumCircle(pts[i], pts[j], pts[k]))
{
// Slight Hax0r: move (last) point a bit so not collinear.
LOG("Warning: had to shift collinear network point.");
pts[k] += pts[k]*0.0001f;
if (!c.CircumCircle(pts[i], pts[j], pts[k]))
{
LOG("Error: can't create triangulation!");
return false;
}
}
pointValid = true;
for (unsigned int l=0; l<mNodeCount; l++)
{
if (l != i && l != j && l != k)
{
if (c.IsPointInside(pts[l]))
{
pointValid = false;
break;
}
}
}
if (pointValid)
{
// Add triangle as graph links
Node(i).AddLink(Node(j));
Node(j).AddLink(Node(k));
Node(k).AddLink(Node(i));
}
}
}
}
Posted 15 September 2005 - 03:23 AM
Posted 16 August 2011 - 12:45 PM
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.