general cleanup

This commit is contained in:
zzzzrrr 2010-04-23 13:11:13 -04:00
parent 4ca5a5c8ca
commit bab616f9ea
3 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,6 @@
#include "sweep_context.h"
#include "advancing_front.h"
#include "../common/utils.h"
#include <iostream>
namespace p2t {
@ -40,7 +39,7 @@ namespace p2t {
void Sweep::Triangulate(SweepContext& tcx)
{
tcx.InitTriangulation();
tcx.CreateAdvancingFront();
tcx.CreateAdvancingFront(nodes_);
// Sweep points; build mesh
SweepPoints(tcx);
// Clean up

View File

@ -119,7 +119,7 @@ Node& SweepContext::LocateNode(Point& point)
return *front_->LocateNode(point.x);
}
void SweepContext::CreateAdvancingFront()
void SweepContext::CreateAdvancingFront(std::vector<Node*> nodes)
{
Node *head, *middle, *tail;
// Initial triangle
@ -132,6 +132,11 @@ void SweepContext::CreateAdvancingFront()
tail = new Node(*triangle->GetPoint(2));
front_ = new AdvancingFront(*head, *tail);
// Memory management :)
nodes.push_back(head);
nodes.push_back(middle);
nodes.push_back(tail);
// TODO: More intuitive if head is middles next and not previous?
// so swap head and tail
head->next = middle;

View File

@ -69,7 +69,7 @@ Node& LocateNode(Point& point);
void RemoveNode(Node* node);
void CreateAdvancingFront();
void CreateAdvancingFront(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);