You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
6.0 KiB
C

/**
*
* @file FITKPolyDataTool.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*
*/
#ifndef FITKPOLYDATATOOL_H
#define FITKPOLYDATATOOL_H
#include "FITKVTKAlgorithmAPI.h"
#include <QList>
#include <QPair>
#include <vtkLine.h>
#include <QVector3D>
#include <QMap>
#define CELLPAIR QPair< int, int >
class vtkPolyData;
class vtkDataArray;
class vtkIntArray;
namespace Common
{
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*/
class FITKVTKALGORITHMAPI FITKPolyDataTool
{
public:
FITKPolyDataTool(vtkPolyData* poly, vtkDataArray* normals);
~FITKPolyDataTool();
/**
* @brief
* @param seedID
* @param angleHold
* @return QList< int >
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*/
QList< int > getCoPlanePointIDs(int seedID, double angleHold);
/**
* @brief
* @param seedID
* @param angleHold
* @return QList< int >
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*/
QList< int > getCoPlaneCellIDs(int seedID, double angleHold);
/**
* @brief
* @param seedID
* @param eles
* @return QList< int >
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*/
QList< int > getNormalSingularID(const int seedID, const QList<int> &eles);
/**
* @brief 线ID线ID线
* @param int pointID 线ID
* @param bool & isFirst
* @return int 线ID
* @time 2023/10/28
* @author maguiwa(maguiwa520@163.com)
*/
int getCellIdFromEdgePoint(int pointID, bool& isFirst);
/**
* @brief 线
* @param int pointID ID
* @param double angle
* @return QList< int >
* @time 2023/10/28
* @author maguiwa(maguiwa520@163.com)
*/
QList< int > getEdgePointsByAngle(int pointID, double angle);
/**
* @brief 线线线ID线
* @param int cellID 线ID
* @param double angle
* @return QList< int > 线
* @time 2023/10/28
* @author maguiwa(maguiwa520@163.com)
*/
QList< int > getEdgeLinesByAngle(int cellID, double angle);
/**
* @brief
* @param int pt1ID
* @param int pt2ID
* @return int
* @time 2023/10/29
* @author maguiwa(maguiwa520@163.com)
*/
int getCellIDbyPtID(int pt1ID, int pt2ID);
/**
* @brief 线IDpointIndexangle线
* @param int cellID 线ID
* @param int pointIndex 线0线01线1
* @param double angle 线
* @param bool autoReverse
* @return int 线ID
* @time 2023/10/28
* @author maguiwa(maguiwa520@163.com)
*/
int getNextEdgeLineByAngle(int cellID, int pointIndex, double angle);
/// 获取与该单元同向的特征边,正反向查找
QList< int > getEdgeLinesByDirectionAndAngle(int cellID, double angle, bool endWithCross = false);
/// 获取与该特征边单元同向的符合条件的特征边
QList< int > getNextEdgeLineByDirectionAndAngle(int cellID, bool down, double angle, bool endWithCross = false);
int getPointIDByPointPosition(double pos[3]);
QVector< int > reuduceSharePointLine(QVector< int > cellIDs);
private:
/**
* @brief
* @param cellID
* @param scanedCellIDs ID
* @return QList< CELLPAIR >
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2023-07-29
*/
QList< CELLPAIR > getNeighborCell(int cellID/*, const QList< int >& scanedCellIDs*/);
bool calculateCellNormal(const int cellID, double* normal);
/**
* @brief 线
* @param int cellID 线ID
* @param double & vec [ 3 ] 线
* @return void
* @time 2023/10/31
* @author maguiwa(maguiwa520@163.com)
*/
void getLineItemVector(int cellID, double(&vec)[3]);
private:
vtkPolyData* _poly{}; //面网格
vtkDataArray* _normals{}; //面网格法向
QMap< int, QVector3D > _points;
// 是否已被检索过。
vtkIntArray* m_scanCellFlag{ nullptr };
// 是否为共面(夹角)单元的节点。
vtkIntArray* m_scanPointCoPlaneFlag{ nullptr };
// 是否为共面(夹角)单元。
vtkIntArray* m_scanCellCoPlaneFlag{ nullptr };
};
} // namespace Common
#endif // FITKPOLYDATATOOL_H