face.cpp

来自「此代码主要用于汽车车身的优化」· C++ 代码 · 共 68 行

CPP
68
字号
// Face.cpp: implementation of the Face class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Subdiv.h"
#include "Face.h"

#include <iostream>

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

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

Face::Face(vector<int> & faceVertexsIdx, int idx) //m_index:idx, m_newFacePointIdx:-1, m_vertexIdxSet:faceVertexsIdx
{
	m_index = idx;
	m_newFacePointIdx = -1;
	this->m_vertexIdxSet = faceVertexsIdx;
}

Face::~Face()
{
	reset();
}

int Face::getVertexNumber()//顶点数目
{	// must be a close face
	return m_vertexIdxSet.size();
}
/*
void Face::addEdge(Mesh::EDGEPOS edgeIdx)
{
	m_edgePosSet.push_back(edgeIdx);
//	dump();
}*/

bool Face::operator == (const Face& f) const
{
	ASSERT(m_index != -1 && f.m_index != -1);
	return (m_index == f.m_index);
}

void Face::dump() const
{
	cout << "DUMP: Face " << m_index + 1 << "  face point idx:" << m_newFacePointIdx << endl;
	cout << "           Edges: " ;
	for(EDGEPOSSET::const_iterator itr = m_edgePosSet.begin(); itr != m_edgePosSet.end(); itr ++)
		cout << "<" << (*itr)->m_bgVertexIdx + 1 << "," << (*itr)->m_edVertexIdx + 1 << "> " ;
//	cout << endl;
	cout << " Vertexs: " ;
	for(VERTEXPOSSET::const_iterator itr2 = m_vertexIdxSet.begin(); itr2 != m_vertexIdxSet.end(); itr2 ++)
		cout << (*itr2) + 1 << " ";
	cout << endl;
}

void Face::reset()
{
	m_vertexIdxSet.clear();
	m_edgePosSet.clear();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?