- C3d aggiornamento librerie ( 118044).
This commit is contained in:
SaraP
2025-08-28 14:47:28 +02:00
parent daccdfc398
commit f05795ffff
53 changed files with 1756 additions and 520 deletions
+424 -4
View File
@@ -11,13 +11,14 @@
#define __OP_POLYMESH_PARAMETERS_H
#include <math_define.h>
#include <polymesh.h>
#include <mb_placement3d.h>
#include <mb_data.h>
#include <templ_sptr.h>
#include <topology.h>
#include <curve3d.h>
#include <m2b_mesh_curvature.h>
class MbPolymesh;
class MbFaceShell;
class MbHalfedgeAttrSizetEdge;
class MbHalfedgeAttrDoubleEdge;
@@ -483,6 +484,7 @@ public:
Parameters may contain information about corresponding edges from polymeshes being merged - these edges will be marked as twins.
The first pair element is the edge index from the topology of a polymesh being copied.
The second pair element is the edge index from the topology of a polymesh accumulating merged objects. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
@@ -651,6 +653,7 @@ public:
Результаты содержат массив цепочек пар рёбер вдоль проекции.
\en Results of projecting a polyline on a polymesh. \n
Results contain paths of edge pairs along the projection. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
@@ -676,6 +679,193 @@ public:
};
//------------------------------------------------------------------------------
/** \brief \ru Перечисление для способа обработки результатов проецирования и других операций.
\en Enumeration for projection results processing method and other operations. \~
*/
// ---
enum class ProjProcessingMethod : uint
{
insert, ///< \ru Просто врезать в сетку. \en Just embed into a mesh.
splitSegmentation, ///< \ru Разбить сегментацию. \en Split a segmentation.
keepOuterPart, ///< \ru Оставить в сетке только внешнюю часть контура. \en Keep only outer part of contour.
keepInnerPart ///< \ru Оставить в сетке только внутреннюю часть контура. \en Keep only inner part of a contour.
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры обрезки полигонального объекта набором кривых.
\en Parameters for cutting a polymesh with a set of curves. \~
\details \ru Параметры обрезки полигонального объекта набором кривых. \n
Сначала кривые линеаризуются с указанной точностью. Далее полученные
полилинии проецируются на сетку. Результат проецирования обрабатывается
указанным способом.
\en Parameters for cutting a polymesh with a set of curves. \n
First, curves are linearized with a given tolerance. Then the resulting
polylines are projected on a mesh. The projection results are processed
with a given method. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbCurvePolymeshProjectParams : public MbPrecision
{
protected:
c3d::ConstSpaceCurvesSPtrVector _curves; ///< \ru Кривые. \en Curves. \~
std::vector<ProjProcessingMethod> _types; ///< \ru Способ обработки для каждой кривой. \en Processing method for an each curve. \~
MbStepData _stepData; ///< \ru Данные для расчета шага. \en Data for the step calculation. \~
public:
/// \ru Конструктор. \en Constructor.
MbCurvePolymeshProjectParams();
/// \ru Деструктор. \en Destructor.
~MbCurvePolymeshProjectParams();
public:
// \ru Получить кривую по индексу. \en Get the curve by index. \~
const c3d::ConstSpaceCurveSPtr & GetCurve( size_t iCrv ) const { return _curves[iCrv]; }
// \ru Получить способ обработки кривой по индексу. \en Get the curve processing method by index. \~
ProjProcessingMethod GetProcessingType( size_t iCrv ) const { return _types[iCrv]; }
// \ru Получить количество кривых. \en Get the curves count. \~
size_t CurveCount() const { return _curves.size(); }
// \ru Получить данные для расчета шага. \en Get data for the step calculation. \~
const MbStepData & GetStepData() const { return _stepData; }
// \ru Добавить кривую. \en Add the curve. \~
void AddCurve( const c3d::ConstSpaceCurveSPtr & crv, ProjProcessingMethod type );
// \ru Установить данные для расчета шага. \en Set data for the step calculation. \~
void SetStepData( const MbStepData & data ) { _stepData = data; }
OBVIOUS_PRIVATE_COPY( MbCurvePolymeshProjectParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры оффсета цепочки ребер полигонального объекта.
\en Parameters for polymesh edge pathes offsetting. \~
\details \ru Параметры оффсета цепочки ребер полигонального объекта. \n
\en Parameters for polymesh edge pathes offsetting. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbPathPolymeshOffsetParams
{
public:
//------------------------------------------------------------------------------
/** \brief \ru Перечисление для способа обработки концов незамкнутых оффсетированных кривых.
\en Enumeration for ends processing method for open (non-closed) offset curves. \~
*/
// ---
enum class EndProcessingMethod
{
doNothing, ///< \ru Оставить как есть. \en Do nothing.
growToBoundary, ///< \ru Дорастить до открытой границы. \en Grow to the open mesh boundary.
connect, ///< \ru Соединить отрезком. \en Connect by the straight line.
round ///< \ru Скруглить. \en Make rounded.
};
private:
std::vector<c3d::IndicesPairsVector> _paths; ///< \ru Цепочки пар рёбер. \en Paths of edge pairs. \~
c3d::DoubleVector _offsetsLeft; ///< \ru Величина оффсета влево. \en Left offset value. \~
c3d::DoubleVector _offsetsRight; ///< \ru Величина оффсета вправо. \en Right offset value. \~
std::vector<EndProcessingMethod> _typesBeg; ///< \ru Способ обработки начал. \en Beginning processing method. \~
std::vector<EndProcessingMethod> _typesEnd; ///< \ru Способ обработки концов. \en End processing method. \~
std::vector<ProjProcessingMethod> _types; ///< \ru Способ обработки для каждой цепочки. \en Processing method for an each path. \~
public:
/// \ru Конструктор. \en Constructor.
MbPathPolymeshOffsetParams();
/// \ru Деструктор. \en Destructor.
~MbPathPolymeshOffsetParams();
// \ru Получить количество цепочек. \en Get the path count. \~
size_t PathCount() const { return _paths.size(); }
// \ru Получить цепочку. \en Get the path. \~
const c3d::IndicesPairsVector & GetEdgePairPath( size_t iPath ) const { return _paths[iPath]; }
// \ru Получить величину оффсета влево. \en Get the left offset value. \~
double GetOffsetLeft( size_t iPath ) const { return _offsetsLeft[iPath]; }
// \ru Получить величину оффсета вправо. \en Get the right offset value. \~
double GetOffsetRight( size_t iPath ) const { return _offsetsRight[iPath]; }
// \ru Получить способ обработки концов. \en Get the end processing method. \~
EndProcessingMethod GetEndProcessingMethod( size_t iPath, bool bEnd ) const { return bEnd ? _typesEnd[iPath] : _typesBeg[iPath]; }
// \ru Получить способ обработки цепочки. \en Get the path processing method. \~
ProjProcessingMethod GetProjProcessingMethod( size_t iPath ) const { return _types[iPath]; }
/** \brief \ru Добавить цепочку.
\en Add a path. \~
\details \ru Добавить цепочку.
\en Add a path. \~
\param[in] path - \ru Цепочка. \n
\en Path. \~
\param[in] offsetLeft - \ru Величина оффсета влево. \n
\en Left offset value. \~
\param[in] offsetRight - \ru Величина оффсета вправо. \n
\en Right offset value. \~
\param[in] typeBeg - \ru Способ обработки начала. \n
\en Method for the offset beginning processing. \~
\param[in] typeEnd - \ru Способ обработки конца. \n
\en Method for the offset end processing. \~
\param[in] method - \ru Способ обработки результата оффсета. \n
\en Method for the offset results processing. \~
*/
void AddPath( const c3d::IndicesPairsVector & path, double offsetLeft, double offsetRight, EndProcessingMethod typeBeg, EndProcessingMethod typeEnd, ProjProcessingMethod method );
// \ru Получить все цепочки. \en Get all pathes. \~
const std::vector<c3d::IndicesPairsVector> & GetEdgePairPathes() const { return _paths; }
OBVIOUS_PRIVATE_COPY( MbPathPolymeshOffsetParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Результаты обрезки полигонального объекта набором кривых.
\en Results of cutting a polymesh with a set of curves. \~
\details \ru Результаты обрезки полигонального объекта набором кривых. \n
Результаты содержат массивы цепочек пар рёбер вдоль проекции каждой кривой
и флаги пересечения и самопересечения.
\en Results of cutting a polymesh with a set of curves. \n
Results contain paths of edge pairs along the projection of an each curve,
and intersection and self-intersection flags. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbPolymeshProjectResults
{
private:
std::vector<std::vector<c3d::IndicesPairsVector>> _paths; //< \ru Цепочки пар рёбер. \en Paths of edge pairs. \~
bool _bIntersection; ///< \ru Флаг наличия пересечений. \en An intersections flag. \~
bool _bSelfIntersection; ///< \ru Флаг наличия самопересечений. \en A self-intersections flag. \~
public:
/// \ru Конструктор. \en Constructor.
MbPolymeshProjectResults();
/// \ru Деструктор. \en Destructor.
~MbPolymeshProjectResults();
public:
// \ru Получить количество кривых. \en Get the curves count. \~
size_t CurveCount() const { return _paths.size(); }
// \ru Получить количество цепочек для кривой. \en Get the pathes count for a curve. \~
size_t CurvePathCount( size_t iCrv ) const { return _paths[iCrv].size(); }
// \ru Получить цепочку для кривой. \en Get the path for a curve. \~
const c3d::IndicesPairsVector & GetEdgePairPath( size_t iCrv, size_t iPath ) const { return _paths[iCrv][iPath]; }
// \ru Получить цепочку для кривой. \en Get the path for a curve. \~
c3d::IndicesPairsVector & GetEdgePairPath( size_t iCrv, size_t iPath ) { return _paths[iCrv][iPath]; }
// \ru Проверить наличие пересечений. \en Check for intersections. \~
bool HasIntersections() const { return _bIntersection; }
// \ru Проверить наличие самопересечений. \en Check for self-intersections. \~
bool HasSelfIntersections() const { return _bSelfIntersection; }
// \ru Инициализировать данные. \en Initialize data.
void Init( const std::vector<std::vector<c3d::IndicesPairsVector>> & paths, bool bIntersect, bool bSelfintersect );
OBVIOUS_PRIVATE_COPY( MbPolymeshProjectResults );
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры заполнения отверстия, заданного замкнутой кривой.
\en Parameters for filling a hole defined by a closed curve. \~
@@ -683,6 +873,7 @@ public:
Параметры содержат точки на границе отверстия.
\en Parameters for filling a hole defined by a closed curve. \n
Parameters contain points on the hole's boundary. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
@@ -715,6 +906,7 @@ public:
Параметры содержат индексы рёбер на границе отверстия.
\en Parameters for filling a polygonal object hole. \n
Parameters contain the indices of the edges from the hole's boundary. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
@@ -723,10 +915,10 @@ class MATH_CLASS MbFillPolymeshHoleParams
{
public:
//------------------------------------------------------------------------------
/** \brief \ru Перечисление методов заполнения отверстия.
/** \brief \ru Перечисление методов заполнения отверстия.
\en Enumeration for filling methods. \~
*/
// ---
*/
// ---
enum class MethodFillPolymeshHole
{
full, ///< \ru Полный. \en Full.
@@ -775,6 +967,7 @@ public:
\en Parameters for calculation of normal vectors at the vertices of a polygonal object. \~
\details \ru Параметры расчета нормалей в вершинах полигонального объекта. \n
\en Parameters for calculation of normal vectors at the vertices of a polygonal object. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
@@ -799,4 +992,231 @@ public:
OBVIOUS_PRIVATE_COPY( MbPolymeshNormalsParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Критерий сегментации полигонального объекта.
\en A criterion for segmenting a polygonal object. \~
\ingroup Polygonal_Objects
*/
// ---
enum class MbeSegmentationCriterion
{
openBoundary = 0, ///< \ru Критерий открытой границы. \en Open boundary criterion.
sharpEdges = 1, ///< \ru Критерий острых рёбер. \en Sharp edges criterion.
curvature = 2 ///< \ru Критерий кривизны. \en Curvature criterion.
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры сегментации полигонального объекта.
\en Parameters for segmenting a polygonal object. \~
\details \ru Параметры сегментации полигонального объекта.
Есть возможность сегментировать по открытым границам, по острым сломам, по кривизне.
\en Parameters for segmenting a polygonal object.
It can be segmented based on open boundaries, on sharp edges, on curvature. \~
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbSegmentationParams
{
private:
MbeSegmentationCriterion _criterion; ///< \ru Критерий сегментации. \en Segmentation criterion. \~
double _angleSharp; ///< \ru Порог угла для острых рёбер (в градусах). \en The angle threshold for sharp edges (in degrees). \~
double _curvMaxValue; ///< \ru Значение порога кривизны. \en The curvature threshold value. \~
MbeCurvatureType _curvType; ///< \ru Тип порога кривизны. \en The curvature threshold type. \~
c3d::IndicesVector _regions; ///< \ru Выбранные для сегментации регионы. \en The regions to be segmented. \~
bool _bKeep; ///< \ru Сохранять имеющуюся сегментацию (при наличии). \en Keep the existing segmentation (if exists). \~
public:
/// \ru Конструктор. \en Constructor.
MbSegmentationParams()
: _criterion ( MbeSegmentationCriterion::openBoundary )
, _angleSharp ( MB_MAXDOUBLE )
, _curvMaxValue( MB_MAXDOUBLE )
, _curvType ( MbeCurvatureType::mean )
, _regions ( )
, _bKeep ( true )
{
}
/// \ru Деструктор. \en Destructor.
~MbSegmentationParams() {}
public:
/// \ru Инициализировать параметры сегментации по острым углам (в градусах). \en Initialize the parameters with sharp edges (in degrees). \~
void InitializeWithSharpEdges( double angleSharp )
{
_criterion = MbeSegmentationCriterion::sharpEdges;
_angleSharp = angleSharp;
}
/// \ru Инициализировать параметры сегментации по кривизне. \en Initialize the parameters with a curvature value. \~
void InitializeWithCurvature( double curvMaxValue, MbeCurvatureType curvType )
{
_criterion = MbeSegmentationCriterion::curvature;
_curvMaxValue = curvMaxValue;
_curvType = curvType;
}
/// \ru Получить критерий сегментации. \en Get the segmentation criterion. \~
MbeSegmentationCriterion GetCriterion() const { return _criterion; }
/// \ru Получить порог угла для острых рёбер (в градусах). \en Get the angle threshold for sharp edges (in degrees). \~
double GetAngleSharp() const { return _angleSharp; }
/// \ru Получить порог кривизны. \en Get the curvature threshold value. \~
double GetMaxCurvatureValue() const { return _curvMaxValue; }
/// \ru Получить тип порога кривизны. \en Get the curvature threshold type. \~
MbeCurvatureType GetCurvatureType() const { return _curvType; }
/// \ru Получить выбранные регионы для редактирования. \en Get the selected regions for editing. \~
c3d::IndicesVector & GetSelectedRegions() { return _regions; }
/// \ru Получить выбранные регионы. \en Get the selected regions. \~
const c3d::IndicesVector & GetSelectedRegions() const { return _regions; }
/// \ru Установить флаг сохранения имеющейся сегментации. \en Set the flag of keeping the existing segmentation. \~
void SetKeepExisting( bool bKeep ) { _bKeep = bKeep; }
/// \ru Получить флаг сохранения имеющейся сегментации. \en Get the flag of keeping the existing segmentation. \~
bool GetKeepExisting() const { return _bKeep; }
/// \ru Установить параметры по умолчанию. \en Reset parameters. \~
void ResetParameters()
{
_criterion = MbeSegmentationCriterion::openBoundary;
_angleSharp = MB_MAXDOUBLE;
_curvMaxValue = MB_MAXDOUBLE;
_curvType = MbeCurvatureType::mean;
_regions.clear();
_bKeep = true;
}
OBVIOUS_PRIVATE_COPY( MbSegmentationParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры лечения сегментации полигонального объекта.
\en Parameters for repairing the segmentation of a polygonal object. \~
\details \ru Параметры лечения сегментации полигонального объекта.
После сегментирования полигонального объекта вероятно появление мелких регионов.
Их можно устранить за счет объединения с соседними регионами.
Также есть возможность удалить внутренние рёбра сегментации.
\en Parameters for repairing the segmentation of a polygonal object.
Segmenting can generate small regions - they can be fixed through merging with neighboring ones.
Is it also possible to remove inner segmentation edges. \~
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbRepairSegmentationParams
{
private:
bool _bFixSmall; ///< \ru Устранить мелкие регионы. \en Fix small regions. \~
double _areaThreshold; ///< \ru Порог площади региона. \en Region area threshold. \~
bool _bRemoveInner; ///< \ru Удалить внутренние рёбра. \en Remove inner edges. \~
public:
/// \ru Конструктор по умолчанию. \en Default constructor.
MbRepairSegmentationParams()
: _bFixSmall ( true )
, _areaThreshold( -1. )
, _bRemoveInner ( true )
{
}
/// \ru Конструктор с параметрами. \en Constructor with parameters.
MbRepairSegmentationParams( bool bFixSmallRegions, double areaThreshold, bool bRemoveInnerEdges )
: _bFixSmall ( bFixSmallRegions )
, _areaThreshold( areaThreshold )
, _bRemoveInner ( bRemoveInnerEdges )
{
}
/// \ru Деструктор. \en Destructor.
~MbRepairSegmentationParams() {}
public:
/// \ru Установить флаг устранения мелких регионов. \en Set the flag of fixing small regions. \~
void SetFixSmallRegions( bool bFixSmallRegions ) { _bFixSmall = bFixSmallRegions; }
/// \ru Получить флаг устранения мелких регионов. \en Get the flag of fixing small regions. \~
bool GetFixSmallRegions() const { return _bFixSmall; }
/// \ru Установить порог площади региона. \en Set region area threshold. \~
void SetAreaThreshold( double areaThreshold ) { _areaThreshold = areaThreshold; }
/// \ru Получить порог площади региона. \en Get region area threshold. \~
double GetAreaThreshold() const { return _areaThreshold; }
/// \ru Установить флаг удаления внутренних рёбер. \en Set the flag of removing inner edges. \~
void SetRemoveInnerEdges( bool bRemoveInnerEdges ) { _bRemoveInner = bRemoveInnerEdges; }
/// \ru Получить флаг удаления внутренних рёбер. \en Get the flag of removing inner edges. \~
bool GetRemoveInnerEdges() const { return _bRemoveInner; }
OBVIOUS_PRIVATE_COPY( MbRepairSegmentationParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Параметры булевой операции для двух полигональных объектов.
\en Parameters of a boolean operation with two polygonal objects. \~
\details \ru Параметры булевой операции для двух полигональных объектов. \n
\en Parameters of a boolean operation with two polygonal objects. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbPolymeshBooleanParams : public MbPrecision
{
public:
//------------------------------------------------------------------------------
/** \brief \ru Перечисление типов булевой операции.
\en Enumeration for boolean operation type. \~
*/
// ---
enum class OpType
{
opUnion, ///< \ru Объединение. \en Union. \~
opSubtraction, ///< \ru Вычитание. \en Subtraction. \~
opIntersection, ///< \ru Пересечение. \en Intersection. \~
opNonManifold ///< \ru Неманифолдная сетка. \en Non-manifold mesh. \~
};
private:
OpType _type; ///< \ru Тип булевой операции. \en Boolean operation type. \~
public:
/// \ru Конструктор. \en Constructor.
MbPolymeshBooleanParams( OpType type, double tolerance );
/// \ru Деструктор. \en Destructor.
~MbPolymeshBooleanParams() {}
/// \ru Получить тип булевой операции. \en Get boolean operation type. \~
OpType GetOperationType() const { return _type; }
OBVIOUS_PRIVATE_COPY( MbPolymeshBooleanParams );
};
//------------------------------------------------------------------------------
/** \brief \ru Результаты булевой операции для двух полигональных объектов.
\en Results of a boolean operation with two polygonal objects. \~
\details \ru Результаты булевой операции для двух полигональных объектов. \n
\en Results of a boolean operation with two polygonal objects. \~
\ingroup Polygonal_Objects
\warning \ru В разработке.
\en Under development. \~
*/
// ---
class MATH_CLASS MbPolymeshBooleanResults
{
private:
c3d::IndicesVector _changedSubregions; ///< \ru Индексы измененных подрегионов. \en Changed subregions indicies. \~
c3d::IndicesVector _addedSubregions; ///< \ru Индексы добавленных подрегионов. \en Added subregions indicies. \~
c3d::IndicesVector _deletedSubregions; ///< \ru Индексы удаленных подрегионов. \en Deleted subregions indicies. \~
public:
/// \ru Конструктор. \en Constructor.
MbPolymeshBooleanResults() {}
/// \ru Деструктор. \en Destructor.
~MbPolymeshBooleanResults() {}
// \ru Инициализировать данные. \en Initialize data.
void Init( const c3d::IndicesVector & changed, const c3d::IndicesVector & added, const c3d::IndicesVector & deleted );
// \ru Получить индексы измененных подрегионов. \en Get changed subregions indicies.
const c3d::IndicesVector & GetChangedSubregions() const { return _changedSubregions; }
// \ru Получить индексы добавленных подрегионов. \en Get added subregions indicies.
const c3d::IndicesVector & GetAddedSubregions() const { return _addedSubregions; }
// \ru Получить индексы удаленных подрегионов. \en Get deleted subregions indicies.
const c3d::IndicesVector & GetDeletedSubregions() const { return _deletedSubregions; }
OBVIOUS_PRIVATE_COPY( MbPolymeshBooleanResults );
};
#endif // __OP_POLYMESH_PARAMETERS_H