www.pudn.com > VC++Delaunay.rar > Triangle.cpp


// Triangle.cpp: implementation of the CTriangle class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "Delaunay.h" 
#include "pointpos.h" 
#include "Triangle.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
IMPLEMENT_SERIAL(CTriangle,CObject,1)  // 
 
CTriangle::CTriangle() 
{ 
 
} 
 
CTriangle::~CTriangle() 
{ 
 
} 
void CTriangle::Serialize(CArchive& ar) ////// 
{ 
	if(ar.IsStoring()) 
	{ 
		ar<>m_p1>>m_p2>>m_p3; 
		ar>>m_xc>>m_yc>>m_rad; 
        ar>>m_x>>m_y; 
	} 
} 
 
POS CTriangle::Where(CPointPos *pos) 
{ 
	//点与外接圆 
	//think of 点在边上,????? 
    double distance; 
	distance=sqrt((pos->m_x-m_xc)*(pos->m_x-m_xc)+(pos->m_y-m_yc)*(pos->m_y-m_yc)); 
	if(fabs(distance-m_rad)<0.0000000001) 
	{ 
		AfxMessageBox("Four points in a circle,need a new ponit"); 
        return POS_ERROR; 
	} 
	 
	if(distance