added p2t namespace

This commit is contained in:
zzzzrrr
2010-01-22 19:50:35 -05:00
parent 793760887b
commit 5dbe785975
13 changed files with 49 additions and 17 deletions

View File

@@ -30,6 +30,8 @@
*/
#include "advancing_front.h"
namespace p2t {
AdvancingFront::AdvancingFront(Node& head, Node& tail)
{
head_ = &head;
@@ -104,3 +106,6 @@ AdvancingFront::~AdvancingFront()
delete search_node_;
delete tail_;
}
}

View File

@@ -30,6 +30,8 @@
*/
#include "../common/shapes.h"
namespace p2t {
struct Node;
// Advancing front node
@@ -108,3 +110,5 @@ inline void AdvancingFront::set_search(Node* node)
search_node_ = node;
}
}

View File

@@ -30,6 +30,8 @@
*/
#include "cdt.h"
namespace p2t {
CDT::CDT(Point** polyline, const int& point_count)
{
sweep_context_ = new SweepContext(polyline, point_count);
@@ -45,12 +47,12 @@ void CDT::Triangulate()
sweep_->Triangulate(*sweep_context_);
}
std::vector<Triangle*> CDT::GetTriangles()
std::vector<p2t::Triangle*> CDT::GetTriangles()
{
return sweep_context_->GetTriangles();
}
std::list<Triangle*> CDT::GetMap()
std::list<p2t::Triangle*> CDT::GetMap()
{
return sweep_context_->GetMap();
}
@@ -61,3 +63,5 @@ CDT::~CDT()
delete sweep_;
}
}

View File

@@ -32,6 +32,8 @@
#include "sweep_context.h"
#include "sweep.h"
namespace p2t {
class CDT
{
public:
@@ -55,3 +57,5 @@ Sweep* sweep_;
/// Destructor
~CDT();
};
}

View File

@@ -33,6 +33,8 @@
#include "advancing_front.h"
#include "../common/utils.h"
namespace p2t {
// Triangulate simple polygon with holes
void Sweep::Triangulate(SweepContext& tcx)
{
@@ -801,4 +803,5 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle&
}
}
}

View File

@@ -28,7 +28,6 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Sweep-line, Constrained Delauney Triangulation (CDT) See: Domiter, V. and
* Zalik, B.(2008)'Sweep-line algorithm for constrained Delaunay triangulation',
@@ -37,6 +36,8 @@
* "FlipScan" Constrained Edge Algorithm invented by Thomas <20>hl<68>n, thahlen@gmail.com
*/
namespace p2t {
class SweepContext;
struct Node;
struct Point;
@@ -110,3 +111,5 @@ void FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& flip_t
void FinalizationPolygon(SweepContext& tcx);
};
}

View File

@@ -33,6 +33,8 @@
#include <GL/glfw.h>
#include "advancing_front.h"
namespace p2t {
SweepContext::SweepContext(Point** polyline, const int& point_count)
{
basin = Basin();
@@ -168,3 +170,5 @@ SweepContext::~SweepContext()
delete tail_;
delete front_;
}
}

View File

@@ -31,6 +31,8 @@
#include <list>
#include <vector>
namespace p2t {
// Inital triangle factor, seed triangle will extend 30% of
// PointSet width to both left and right.
const double kAlpha = 0.3;
@@ -41,7 +43,6 @@ struct Node;
struct Edge;
class AdvancingFront;
class SweepContext {
public:
@@ -166,3 +167,5 @@ inline Point* SweepContext::tail()
{
return tail_;
}
}