52 lines
841 B
C++
52 lines
841 B
C++
// Face.cpp: implementation of the CFace class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "Test.h"
|
|
#include "Face.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CFace::CFace()
|
|
{
|
|
vI=NULL;
|
|
t=NULL;
|
|
fNormal=CVector(CP3(0.0,0.0,1.0));
|
|
}
|
|
|
|
CFace::~CFace()
|
|
{
|
|
if(vI!=NULL)
|
|
{
|
|
delete []vI;
|
|
vI=NULL;
|
|
}
|
|
if(t!=NULL)
|
|
{
|
|
delete[] t;
|
|
t=NULL;
|
|
}
|
|
}
|
|
|
|
void CFace::SetNum(int n)
|
|
{
|
|
vN=n;
|
|
vI=new int[n];
|
|
t=new CT2[n];
|
|
}
|
|
|
|
void CFace::SetFaceNormal(CP3 pt0,CP3 pt1,CP3 pt2)//¼ÆËãÐ¡Ãæ·¨Ê¸Á¿
|
|
{
|
|
CVector V01(pt0,pt1);
|
|
CVector V02(pt0,pt2);
|
|
fNormal=Cross(V01,V02);
|
|
} |