步骤
- 使用TopExp取出拓扑边TopoDS_Edge的起末拓扑顶点TopoDS_Vertex;
- 使用BRep_Tool从拓扑顶点取出几何点gp_Pnt
测试代码
#include <iostream>
#include "BRepBuilderAPI_MakeEdge.hxx"
#include "TopoDS_Edge.hxx"
#include "gp_Pnt.hxx"
#include "TopExp.hxx"
#include "BRep_Tool.hxx"
#ifdef _DEBUG
#pragma comment(lib, "TKerneld.lib")
#pragma comment(lib, "TKBRepd.lib")
#pragma comment(lib, "TKTopAlgod.lib")
#endif
void DumpPoint(const gp_Pnt& ptPoint)
{
	std::cout << "(" << ptPoint.X() << "," << ptPoint.Y() << "," << ptPoint.Z() << ")";
}
int main(int argc, char** argv )
{
	BRepBuilderAPI_MakeEdge aEdge(gp_Pnt(0, 0, 0), gp_Pnt(100, 0, 0));
	TopoDS_Vertex aFirstVertex = TopExp::FirstVertex(aEdge);
	TopoDS_Vertex aLastVertex = TopExp::LastVertex(aEdge);
	gp_Pnt aFirstPoint = BRep_Tool::Pnt(aFirstVertex);
	gp_Pnt aLastPoint = BRep_Tool::Pnt(aLastVertex);
	
	DumpPoint(aFirstPoint);
	DumpPoint(aLastPoint);
	std::cout << std::endl;
	return 0;
}                










