120 lines
3.1 KiB
C++
120 lines
3.1 KiB
C++
//-----------------------------------------------------------------------------+
|
||
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
||
// = FileName : TBPloygon.h
|
||
// = Version : ver2.0
|
||
// = Author : xlc
|
||
// = CreateDate : 2002-09-09
|
||
// = Description: 类的声明 描述单连通区域
|
||
// = Maintainers:
|
||
//
|
||
//-----------------------------------------------------------------------------+
|
||
#ifndef _TBPLOYGON_H_
|
||
#define _TBPLOYGON_H_
|
||
|
||
#ifndef _TBPLOYLINE_H_
|
||
#include "TBPloyLine.h"
|
||
#endif
|
||
|
||
#ifndef _TDPTRLIST_H_
|
||
#include "TDPtrList.h"
|
||
#endif
|
||
|
||
#ifndef _TACDBFACEPTR_H_
|
||
#include "TAcDbFacePtr.h"
|
||
#endif
|
||
|
||
#ifndef _TGGETRIANGLE_H_
|
||
#include "TGGeTriangle.h"
|
||
#endif
|
||
|
||
class TBNode;
|
||
class TBPloygon;
|
||
typedef CTypedPtrList<CObList, TBPloygon*> TBPolygonList;
|
||
|
||
class GEOAPI TBPloygon : public TBPloyLine
|
||
{
|
||
public:
|
||
TBPloygon();
|
||
TBPloygon(const TBPloyLine& bline);
|
||
#if ADS>16
|
||
TBPloygon(const TBPloygon& poly);
|
||
#endif
|
||
virtual ~TBPloygon();
|
||
|
||
//返回下一结点,当作封闭环
|
||
virtual TBNode* GetNextNode(TBNode* pNode);
|
||
//返回上一结点,当作封闭环
|
||
virtual TBNode* GetPreNode(TBNode* pNode);
|
||
|
||
//判断多边形pPolygon是否在此多边形内部
|
||
//返回0:相交
|
||
//如果返回1,则包含pPolygon,
|
||
//如果返回2,则被pPolygon包含
|
||
//如果返回3,则与pPolygon互不包含
|
||
BOOL IsSurrounded(TBPloyLine* pPolygon);
|
||
|
||
//释放内存
|
||
void ReleaseRgnLst(TBPolygonList& sRgnList);
|
||
|
||
//是否平行于XY平面
|
||
BOOL IsParallelToXY(double tol);
|
||
|
||
//根据此面创建m_plane
|
||
BOOL CreatAcGePlane();
|
||
|
||
//构造从当前坐标系到此平面所在的坐标系的变换矩阵
|
||
AcGeMatrix3d GetUCSToECSMat();
|
||
|
||
//构造从此平面所在的坐标系到当前坐标系的变换矩阵
|
||
AcGeMatrix3d GetECSToUCSMat();
|
||
|
||
//将此区域通过矩阵mat进行变换
|
||
void TransformBy(AcGeMatrix3d& mat);
|
||
|
||
//返回下下一结点
|
||
TBNode* GetNextNode2(TBNode* pNode);
|
||
|
||
//三角化单连通区域,并将三角形存于sRgnList
|
||
BOOL TrianglizePolygon(TBPolygonList& sRgnList);
|
||
|
||
//将此区域一分为二直到全为三角形,并将三角形存于sRgnList
|
||
void CutDown(TBPolygonList& sRgnList);
|
||
|
||
//测试pTestNode是否在以pNode为结点的前后两边内部
|
||
BOOL IsPtInsideRgn(TBNode* pNode,TBNode* pTestNode);
|
||
|
||
//连线PT1-PT2是否于其他边相交
|
||
BOOL IsCrossOtherEdges(TBNode* pNode1,TBNode* pNode2);
|
||
|
||
//pNode1和pNode2组成的连线是否可以将此区域分为两个单连通域
|
||
BOOL IsASuitableDivLine(TBNode* pNode1,TBNode* pNode2);
|
||
|
||
//以结点1-2为分界将此区域一分为二
|
||
void DivideTo2Polygon(TBNode* pNode1,TBNode* pNode2,TBPloygon*& pRgn1,TBPloygon*& pRgn2);
|
||
|
||
//将此结点转化成3DFACE
|
||
AcDbFace* ConvertTo3dFace();
|
||
|
||
//将此结点转化成3DFACE
|
||
TGGeTriangle* ConvertToTriangle();
|
||
|
||
//将此区域三角化为一系列3DFACE
|
||
BOOL ConvertTo3DFaces(TAcDbFacePtrList& face3DList);
|
||
|
||
//将此区域三角化为一系列3DFACE
|
||
BOOL ConvertToTriangle(TDPtrList<TGGeTriangle> &lstRes);
|
||
|
||
public:
|
||
//三角化后的三角区域链表
|
||
TBPolygonList m_childSRList;
|
||
//m_plane是否已经构造成功
|
||
BOOL m_bPlaned;
|
||
//所在平面
|
||
AcGePlane m_plane;
|
||
|
||
private:
|
||
//pt是否在pt11-pt12所在线段上
|
||
BOOL IsOnLineSeg(AcGePoint3d pt11,AcGePoint3d pt12,AcGePoint3d pt,double tol = TOL);
|
||
};
|
||
|
||
#endif |