Скачиваний:
14
Добавлен:
01.05.2014
Размер:
1.37 Кб
Скачать
// Vertex.cpp: implementation of the Vertex class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ConvexHull.h"
#include "Vertex.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Vertex::Vertex(TPoint p):TPoint(p)
{
	
}

Vertex::~Vertex()
{
	
}


Vertex* Vertex::insert(Vertex* v)
{
    return (Vertex*)(Node::insert(v));
}


Vertex* Vertex::split(Vertex* b)
{          
    Vertex *bp = b->ccw()->insert(new Vertex(b->point()));
    insert(new Vertex(point()));
    splice(bp);
    return bp;
}


Vertex* Vertex::ccw(void)
{
    return (Vertex*)_prev;
}


TPoint Vertex::point(void)
{
    //this->used = TRUE; //!!!!!!!!!!!!!!

	return *((TPoint*)this);
}


void Vertex::splice(Vertex* b)
{
    Node::splice(b);
}


Vertex* Vertex::cw(void)
{
    return (Vertex*)_next;
}

Vertex* Vertex::remove(void)
{
    return (Vertex*)(Node::remove());
}


Vertex* Vertex::neighbor(int rotation)
{
    return ((rotation == CLOCKWISE) ? cw() : ccw());
}


int Vertex::GetType(void)
{
    return G_VERTEX;
}




Соседние файлы в папке ConvexHull