mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-11-26 15:26:12 +01:00
general cleanup
This commit is contained in:
parent
4ca5a5c8ca
commit
bab616f9ea
@ -32,7 +32,6 @@
|
|||||||
#include "sweep_context.h"
|
#include "sweep_context.h"
|
||||||
#include "advancing_front.h"
|
#include "advancing_front.h"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
@ -40,7 +39,7 @@ namespace p2t {
|
|||||||
void Sweep::Triangulate(SweepContext& tcx)
|
void Sweep::Triangulate(SweepContext& tcx)
|
||||||
{
|
{
|
||||||
tcx.InitTriangulation();
|
tcx.InitTriangulation();
|
||||||
tcx.CreateAdvancingFront();
|
tcx.CreateAdvancingFront(nodes_);
|
||||||
// Sweep points; build mesh
|
// Sweep points; build mesh
|
||||||
SweepPoints(tcx);
|
SweepPoints(tcx);
|
||||||
// Clean up
|
// Clean up
|
||||||
|
@ -119,7 +119,7 @@ Node& SweepContext::LocateNode(Point& point)
|
|||||||
return *front_->LocateNode(point.x);
|
return *front_->LocateNode(point.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SweepContext::CreateAdvancingFront()
|
void SweepContext::CreateAdvancingFront(std::vector<Node*> nodes)
|
||||||
{
|
{
|
||||||
Node *head, *middle, *tail;
|
Node *head, *middle, *tail;
|
||||||
// Initial triangle
|
// Initial triangle
|
||||||
@ -132,6 +132,11 @@ void SweepContext::CreateAdvancingFront()
|
|||||||
tail = new Node(*triangle->GetPoint(2));
|
tail = new Node(*triangle->GetPoint(2));
|
||||||
front_ = new AdvancingFront(*head, *tail);
|
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?
|
// TODO: More intuitive if head is middles next and not previous?
|
||||||
// so swap head and tail
|
// so swap head and tail
|
||||||
head->next = middle;
|
head->next = middle;
|
||||||
|
@ -69,7 +69,7 @@ Node& LocateNode(Point& point);
|
|||||||
|
|
||||||
void RemoveNode(Node* node);
|
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
|
/// Try to map a node to all sides of this triangle that don't have a neighbor
|
||||||
void MapTriangleToNodes(Triangle& t);
|
void MapTriangleToNodes(Triangle& t);
|
||||||
|
Loading…
Reference in New Issue
Block a user