-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiogBasicTools.h
117 lines (99 loc) · 5.47 KB
/
iogBasicTools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//=============================================================================
//
// Copyright (c) China Automotive Innovation Corporation.
//
// Author : Xia Lei
// Date : 2022/09/09
//
//=============================================================================
#pragma once
#include "iogModule.h"
#include "string.h"
#include "qui.h"
#include <QtCore/qlocale>
#include <unordered_set>
#include "iogOccInclude.h"
#include "iogBinaryTree.h"
class comAssemblyMgr;
class comPartMgr;
class comSurfaceMgr;
class comActorMgr;
class comFaceMgr;
class comVerticeMgr;
class iogBasicTools
{
public:
iogBasicTools();
~iogBasicTools();
static void GetPartName(char* pName, char* pFilePath);
static bool DiscretizeShape(double dLinearDelVal, double dAngleDelVal, int nAllFaces, bool firstloop, UINT uMaxSurfIx, double dScale, std::vector<string> vecUniqName,
std::vector<std::pair<TopoDS_Shape, std::string>> vecnamemap, std::vector<std::pair<TopoDS_Shape, std::string>> vecFaceNameMap,
char* pFilePath, void* pEntryShape, QHash<QString, UINT>& hashVertIdx);
static QString RePartName(QString & strName);
static bool DiscretizeLoopProcess(int nAllFaces, int& nCurrentFace, int& nBeginVtx,
IMeshTools_Parameters meshParas, bool firstloop, UINT uMaxSurfIx, std::vector<string> vecUniqName,
std::vector<std::pair<TopoDS_Shape, std::string>> vecnamemap, std::vector<std::pair<TopoDS_Shape, std::string>> vecFaceNameMap,
UINT nVert, int nCurrentAssIndex, int nShadingType,
TopoDS_Shape mainshape, QHash<QString, UINT>& hashVertIdx
, double dLinearDelVal, double dAngleDelVal);
static bool Heal(TopoDS_Shape &entryShape, double dtolerance, double dholeRad, double dfilletRad);
static bool AutoFillInnerGaps(TopoDS_Shape &entryShape, double tolerance);
static bool LoopFindAdjacentEdge(TopTools_ListOfShape& usedshapes, TopoDS_Shape& startedge,
TopTools_ListOfShape& edgeset, std::vector<TopoDS_Shape>& vecneededges,
TopTools_ListOfShape& xedgegroup);
static bool AutoFillHoles(TopoDS_Shape &entryShape, double maxRadius);
static bool AutoRemoveFreeEdges(TopoDS_Shape &entryShape, double tolerance);
static bool AutoRemoveFillets(TopoDS_Shape &entryShape, double dmaxRad);
static bool AutoMergeEdges(TopoDS_Shape &entryShape);
static bool ClearFreeEdges(bool bIfSTP, double scale, bool firstloop, UINT uMaxFaceIx, TopoDS_Shape entryshape,
UINT maxsurfaceidx, QHash<QString, UINT> hashVertIdx);
static bool AddPntToVec(gp_Pnt pt1, std::vector<gp_Pnt> &vecPnt);
static gp_Dir DirOf2Pnts(gp_Pnt pt1, gp_Pnt pt2);
static bool SplitGroupTriangles(double dPointEqual, std::vector<TopoDS_Edge>& vecEdges,
std::vector<std::vector<TopoDS_Edge>>& vecvecGroups);
static bool FindMergePairs(TopoDS_Shape entryshape,
std::vector<TopoDS_Edge> vecEdges, std::vector<std::pair<UINT, UINT>>& vecnearestpt);
static bool FilterFreeEdgeVtxIndexes(
double dPointEqual,
std::vector<std::pair<UINT, gp_Pnt>> vecPairVtxIndex,
std::vector<TopoDS_Edge> vecFreeEdge,
std::vector<std::pair<UINT, UINT>>& vecIdxPair);
static bool FindTriangleIndex(
std::vector<std::pair<UINT, UINT>> vecIdxPair,
std::vector<std::vector<UINT>>& tris);
static bool GridScale(bool firstloop, UINT nMaxPartIx, UINT nMaxFaceIx, UINT uMaxSurfIx, double dScale);
static QString ReNamePart(QString & strPartName);
static QString ReNameSurf(QString & strSurfName);
static QString ReNameAssembly(QString & strAssemblyName);
static bool Pnt2Inx(gp_Pnt pnt, QHash<QString, UINT>& hashVertIdx, comVerticeMgr * pVertMgr,
int& nBeginVtx, UINT nVert, UINT& uVerts);
static bool GetClosedVertexIdxGroup(vector<vector<pair<basePoint, basePoint>>> inputEdges,
QHash<QString, UINT> hashVertIdx,
vector<vector<UINT>>& groupedIndex);
static bool LoopFindClosedFreeEdges(vector<UINT> &subgroup, vector<UINT>& usedgroup, vector<UINT> allIndx, UINT beginIndx,
QHash<UINT, UINT> hashEdge);
static bool LoopClosedFreeEdges(UINT& startIdx,
vector<pair<UINT, UINT>> vecEdgeIndx
, vector<UINT>& subgroup,
vector<int>& vecUsedIdx);
static bool LoopClosedFreeEdges(UINT& startIdx,
QMultiHash<UINT, UINT> hashEdgeIndx,
vector<UINT>& subgroup);
static double CalculateAngleBetweenDirs(gp_Dir dir1, gp_Dir dir2);
static bool ReplaceVertex(vector<UINT> vecFaceIx, vector<UINT> vecFirstList, vector<UINT> vecSecondList);
static bool ReplaceVertex(vector<UINT> vecFaceIx, UINT vtxIx1, UINT vtxIx2);
static bool FixTrigangle(vector<UINT> currentClosed);
static bool FixTrigangle(UINT u1, UINT u2, UINT u3);
static bool OffsetSelectedSurface(double dDistance, vector<UINT> vecSelectedSurface);
static void GetVertexByFaces(const vector<UINT> & vecFaceIx, std::vector<UINT> & vecVertex);
static void GetVertexBySurfaces(const vector<UINT> & vecSurfaceIx, std::vector<UINT> & vecVertex);
static vector<vector<UINT>> FindConnectedEdges(int nNum, vector<pair<UINT, UINT>>& edges);
static void dfs(int node, const vector<vector<UINT>>& graph, vector<bool>& visited, vector<UINT>& component);
static bool TurnClosedEdgePairToOrderedIndex(vector<pair<UINT, UINT>> vecEdgeIndx,
vector<UINT>& subgroup);
static double CalculateDistanceVtx2Line(gp_Pnt ptStart, gp_Pnt nextPt, gp_Pnt thirdPt);
static bool AutoFillTri(vector<UINT> vecFaceIx, UINT uStart, vector<UINT> vecClosedFreeEdge);
static bool FixClosedFreeEdges(vector<UINT> vecusedFaceIx, vector<UINT> currentClosed);
static bool LoopFillTri(UINT& uStart, UINT& uSecond, QHash<int, UINT>& hashFreeEdge);
static bool SplitVecIntoVecs(vector<UINT> vecToSplit, vector<UINT> vecSplitVtxs, vector<vector<UINT>>& vecVecSplited);
};