0a27141ada
- C3d aggiornamento librerie ( 118012).
320 lines
20 KiB
C++
320 lines
20 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
||
/**
|
||
\file
|
||
\brief \ru Параметры операций над полигональными сетками с топологией.
|
||
\en Parameters of operations on the polygonal meshes with topology. \~
|
||
|
||
*/
|
||
////////////////////////////////////////////////////////////////////////////////
|
||
|
||
#ifndef __OP_POLYMESH_PARAMETERS_H
|
||
#define __OP_POLYMESH_PARAMETERS_H
|
||
|
||
#include <math_define.h>
|
||
#include <mb_placement3d.h>
|
||
#include <mb_data.h>
|
||
#include <templ_sptr.h>
|
||
#include <polymesh.h>
|
||
#include <curve3d.h>
|
||
|
||
class MATH_CLASS MbFaceShell;
|
||
class MATH_CLASS MbHalfedgeAttrSizetEdge;
|
||
class MATH_CLASS MbHalfedgeAttrDoubleEdge;
|
||
class MATH_CLASS MbHalfedgeAttrBoolVertex;
|
||
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Параметры операции расчета кривизн полигональной сетки.
|
||
\en Parameters for mesh curvature calculation. \~
|
||
\details \ru Параметры операции расчета кривизн полигональной сетки.
|
||
Возможны два метода - с помощью дискретного дифференциального оператора, и с помощью вписывания полиномиальной поверхности
|
||
в окрестность вершины. Количество соседей для второго метода должно быть в пределах от 1 до 10.
|
||
\en Parameters for mesh curvature calculation.
|
||
There are two methods are possible - by discrete differential operator and by polynomial surface fitting.
|
||
Number of neighbors for second method must be in the range from 1 to 10. \~
|
||
\ingroup Polygonal_Objects
|
||
*/
|
||
// ---
|
||
class MATH_CLASS MbMeshCurvatureParams
|
||
{
|
||
public:
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Перечисление методов расчета кривизн полигональной сетки.
|
||
*/
|
||
// ---
|
||
enum class MethodCalcCurvatures
|
||
{
|
||
byDiscrDiffOperators, ///< \ru Дискретный дифференциальный оператор. \en Discrete differential operator.
|
||
byApproxPolynom ///< \ru Аппроксимация полиномиальной поверхностью. \en Polynomial surface fitting.
|
||
};
|
||
|
||
private:
|
||
MethodCalcCurvatures _method; ///< \ru Метод расчета. \en Calculation method.
|
||
size_t _nNeighborRing; ///< \ru Количество соседей для аппроксимации поверхностью. \en Number of neighbors for surface fitting.
|
||
|
||
public:
|
||
/// \ru Конструктор. \en Constructor.
|
||
MbMeshCurvatureParams()
|
||
: _method ( MethodCalcCurvatures::byDiscrDiffOperators )
|
||
, _nNeighborRing( 0 )
|
||
{}
|
||
/// \ru Деструктор. \en Destructor.
|
||
~MbMeshCurvatureParams() {}
|
||
|
||
/// \ru Инициализировать метод дискретного оператора. \en Initialize discrete operator method.
|
||
void InitOperatorMethod()
|
||
{
|
||
_method = MethodCalcCurvatures::byDiscrDiffOperators;
|
||
_nNeighborRing = 0;
|
||
}
|
||
/// \ru Инициализировать метод полиномиальной поверхности. \en Initialize polynomial surface method.
|
||
void InitPolynomMethod( size_t nRing )
|
||
{
|
||
_method = MethodCalcCurvatures::byApproxPolynom;
|
||
_nNeighborRing = nRing;
|
||
}
|
||
|
||
///< \ru Получить способ вычисления. \en Get calculation method.
|
||
MethodCalcCurvatures GetMethod() const { return _method; }
|
||
///< \ru Получить количество соседей. \en Get number of neighbors.
|
||
size_t GetRingsNumber() const { return _nNeighborRing; }
|
||
|
||
OBVIOUS_PRIVATE_COPY( MbMeshCurvatureParams )
|
||
};
|
||
|
||
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Параметры драпировки оболочки тканью.
|
||
\en Parameters for the shell draping. \~
|
||
\details \ru Параметры драпировки оболочки тканью. \n
|
||
Параметры содержат информацию о положении развёртки и свойствах материала.
|
||
\en Parameters for the shell draping. \n
|
||
Parameters contain information about the scan position and material properties. \~
|
||
\ingroup Shell_Building_Parameters
|
||
\warning \ru В разработке.
|
||
\en Under development. \~
|
||
*/
|
||
// ---
|
||
class MATH_CLASS MbDrapeShellParams
|
||
{
|
||
public:
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Перечисление для типа констрейна для кривой.
|
||
\en Constraint curve type. \~
|
||
\details \ru Перечисление для типа констрейна для кривой.
|
||
\en Constraint curve type. \~
|
||
*/
|
||
// ---
|
||
enum class ConstraintCurveType
|
||
{
|
||
geodesic, ///< \ru Геодезическая. \en Geodesic.
|
||
curve ///< \ru Заданная кривая. \en Given curve.
|
||
};
|
||
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Перечисление для угла между основой ткани и кривой-кострейна.
|
||
\en Fiber angle from a constraint curve. \~
|
||
\details \ru Перечисление для угла между основой ткани и кривой-кострейна.
|
||
\en Fiber angle from a constraint curve. \~
|
||
*/
|
||
// ---
|
||
enum class AngleFromCurveType
|
||
{
|
||
degrees0, ///< \ru Ноль градусов. \en Zero degrees.
|
||
degreesPlus45, ///< \ru 45 градусов. \en 45 degrees.
|
||
degreesMinus45 ///< \ru Минус 45 градусов. \en Minus 45 degrees.
|
||
};
|
||
|
||
private:
|
||
double _epsSew; ///< \ru Точность сшивки сетки. \en Sew tolerance. \~
|
||
double _cellSize; ///< \ru Размер ячейки ткани. \en Fiber cell size. \~
|
||
ConstraintCurveType _constraintCurveType; ///< \ru Тип кривой-констрейна. \en Constraint curve type. \~
|
||
AngleFromCurveType _angleFromCurveType; ///< \ru Угол между основой ткани и кривой. \en Fiber angle from a curve. \~
|
||
MbPlacement3D _place; ///< \ru Локальная система координат развернутой поверхности. \en The local coordinate system for the result surface. \~
|
||
MbStepData _stepData; ///< \ru Данные для расчета шага. \en Data for the step calculation. \~
|
||
SPtr<MbPolymesh> _mesh; ///< \ru Линеаризация оболочки. \en Shell linearization. \~
|
||
SPtr<const MbCurve3D> _firstStageRegion; ///< \ru Кривая для приоритетной области. \en First stage region curve. \~
|
||
SPtr<const MbCurve3D> _constrainCurve; ///< \ru Кривая-констрейн. \en Constraint curve. \~
|
||
|
||
public:
|
||
/// \ru Конструктор (только для внутреннего использования ). \en Constructor ( for internal usage only ).
|
||
MbDrapeShellParams();
|
||
|
||
public:
|
||
/// \ru Конструктор по параметрам. \en Constructor by parameters.
|
||
MbDrapeShellParams( const MbFaceShell & shell, const MbStepData & stepData, double epsSew = METRIC_EPSILON );
|
||
/// \ru Деструктор. \en Destructor.
|
||
~MbDrapeShellParams();
|
||
|
||
public:
|
||
// \ru Валидны ли данные. \en Is data valid.
|
||
bool IsValid() const;
|
||
// \ru Инициализировать данные. \en Initialize data.
|
||
void Init( const MbPlacement3D & place,
|
||
ConstraintCurveType constrCurveType,
|
||
AngleFromCurveType angFromCurveType,
|
||
double cellSize,
|
||
const MbCurve3D * pConstraintCurve = nullptr,
|
||
const MbCurve3D * pFirstStageRegion = nullptr);
|
||
|
||
// \ru Получить линеаризацию оболочки. \en Get shell linearization. \~
|
||
const SPtr<MbPolymesh> & GetMesh() const { return _mesh; }
|
||
// \ru Получить приоритетную область. \en Get the first stage region. \~
|
||
const SPtr<const MbCurve3D> & GetFirstStageRegion() const { return _firstStageRegion; }
|
||
// \ru Получить для изменения приоритетную область. \en Get first stage region. \~
|
||
SPtr<const MbCurve3D> & SetFirstStageRegion() { return _firstStageRegion; }
|
||
// \ru Получить кривую-констрейн. \en Get constraint curve. \~
|
||
const SPtr<const MbCurve3D> & GetConstraintCurve() const { return _constrainCurve; }
|
||
// \ru Получить для изменения кривую-констрейн. \en Get constraint curve. \~
|
||
SPtr<const MbCurve3D> & SetConstraintCurve() { return _constrainCurve; }
|
||
// \ru Получить данные для расчета шага. \en Get data for step calculation. \~
|
||
const MbStepData & GetStepData() const { return _stepData; }
|
||
|
||
/// \ru Установить локальную систему координат развернутой поверхности сетки. \en Set the local coordinate system for a mesh unwrapping. \~
|
||
void SetPlacement( const MbPlacement3D & pl ) { _place.Init( pl ); }
|
||
// \ru Получить локальную систему координат развернутой поверхности сетки. \en Get the local coordinate system for a mesh unwrapping. \~
|
||
const MbPlacement3D & GetPlacement() const { return _place; }
|
||
/// \ru Установить размер ячейки. \en Set cell size. \~
|
||
void SetCellSize( double cellSize ) { _cellSize = cellSize; }
|
||
// \ru Получить размер ячейки. \en Get cell size. \~
|
||
double GetCellSize() const { return _cellSize; }
|
||
/// \ru Установить тип кривой-констрейна. \en Set constraint curve type. \~
|
||
void SetConstraintCurveType( ConstraintCurveType type ) { _constraintCurveType = type; }
|
||
// \ru Получить тип кривой-констрейна. \en Get constraint curve type. \~
|
||
ConstraintCurveType GetConstraintCurveType() const { return _constraintCurveType; }
|
||
/// \ru Установить угол между основой ткани и кривой. \en Set fiber angle from the curve. \~
|
||
void SetAngleFromCurveType( AngleFromCurveType type ) { _angleFromCurveType = type; }
|
||
// \ru Получить угол между основой ткани и кривой. \en Get fiber angle from the curve. \~
|
||
AngleFromCurveType GetAngleFromCurveType() const { return _angleFromCurveType; }
|
||
|
||
// \ru Функции только для внутреннего использования. \en Functions for the internal usage only.
|
||
|
||
// \ru Получить для изменения линеаризацию оболочки. \en Get the shell linearization. \~
|
||
SPtr<MbPolymesh> & SetMesh() { return _mesh; }
|
||
// \ru Получить для изменения данные для расчета шага. \en Get data for the step calculation. \~
|
||
MbStepData & SetStepData() { return _stepData; }
|
||
// \ru Инициализировать линеаризацию оболочки. \en Initialize the shell linearization. \~
|
||
void InitMesh( const MbFaceShell & shell, const MbStepData & stepData, double epsSew );
|
||
/// \ru Установить точность сшивки. \en Set sew tolerance. \~
|
||
void SetSewTolerance( double epsSew ) { _epsSew = epsSew; }
|
||
// \ru Получить точность сшивки. \en Get sew tolerance. \~
|
||
double GetSewTolerance() const { return _epsSew; }
|
||
|
||
OBVIOUS_PRIVATE_COPY( MbDrapeShellParams );
|
||
}; // MbDrapeShellParams
|
||
|
||
|
||
//------------------------------------------------------------------------------
|
||
/** \brief \ru Результаты драпировки оболочки тканью.
|
||
\en Shell draping results. \~
|
||
\details \ru Результаты драпировки оболочки тканью. \n
|
||
Содержат информацию о ячейках ткани в 3D и развертки в 2D.
|
||
\en Shell draping results. \n
|
||
Results contain information about 3D fiber cells and 2D unwrapping. \~
|
||
\ingroup Shell_Building_Parameters
|
||
\warning \ru В разработке.
|
||
\en Under development. \~
|
||
*/
|
||
// ---
|
||
class MATH_CLASS MbDrapeShellResults
|
||
{
|
||
private:
|
||
SPtr<MbPolymesh> _mesh; ///< \ru Результат. \en The result. \~
|
||
std::vector<c3d::SpacePointsVector> _sides; ///< \ru Полилинии сторон ячеек. \en Cell sides polylines. \~
|
||
std::vector<c3d::SpacePointsVector> _warp; ///< \ru Полилинии для нулевой нити основы. \en Warp polylines. \~
|
||
std::vector<c3d::SpacePointsVector> _weft; ///< \ru Полилинии для нулевой нити утка. \en Weft polylines. \~
|
||
MbHalfedgeAttrSizetEdge * _pAttrId; ///< \ru Атрибут индексов сторон ячеек. \en An attribute for cell sides indices. \~
|
||
MbHalfedgeAttrDoubleEdge * _pAttrAng; ///< \ru Атрибут углов сторон ячеек. \en An attribute for cell sides angles. \~
|
||
MbHalfedgeAttrBoolVertex * _pAttrNode; ///< \ru Атрибут флагов узлов ткани. \en An attribute for the fiber nodes. \~
|
||
|
||
public:
|
||
/// \ru Конструктор. \en Constructor.
|
||
MbDrapeShellResults();
|
||
/// \ru Деструктор. \en Destructor.
|
||
~MbDrapeShellResults();
|
||
|
||
/// \ru Очистить данные. \en Clear data.
|
||
void Clear();
|
||
// \ru Получить результат. \en Get the result. \~
|
||
const SPtr<MbPolymesh> & GetMesh() const { return _mesh; }
|
||
// \ru Получить результат. \en Get the result. \~
|
||
SPtr<MbPolymesh> & SetMesh() { return _mesh; }
|
||
|
||
// \ru Является ли вершина узлом ткани. \en Is vertex a fiber node. \~
|
||
bool IsNode( size_t iVx ) const;
|
||
// \ru Получить угол деформации для ребра сетки. \en Get a deformation angle for the mesh edge. \~
|
||
double GetEdgeAngle( size_t iEd ) const;
|
||
// \ru Получить идентификатор полилинии для этого ребра сетки. \en Get a polyline index for the given mesh edge. \~
|
||
size_t GetSideId( size_t iEd ) const;
|
||
/** \brief \ru Получить полилинии для главной нити основы.
|
||
\en Get a polyline for the main warp thread. \~
|
||
\details \ru Получить полилинии для главной нити основы.
|
||
Эти полилинии идут от точки приложения в положительном и отрицательном направлении
|
||
оси Х локальной системы координат.
|
||
\en Get polyline for maGet a polyline for the main warp thread.
|
||
Polylines go in a positive and negative direction along the X-axis of the local coordinate system.
|
||
*/
|
||
const std::vector<c3d::SpacePointsVector> & GetWarp() const { return _warp; }
|
||
/** \brief \ru Получить полилинии для главной нити утка.
|
||
\en Get a polyline for the main weft thread. \~
|
||
\details \ru Получить полилинии для главной нити утка.
|
||
Эти полилинии идут от точки приложения в положительном и отрицательном направлении
|
||
оси Y локальной системы координат.
|
||
\en Get a polyline for the main weft thread.
|
||
Polylines go in a positive and negative direction along the Y-axis of the local coordinate system.
|
||
*/
|
||
const std::vector<c3d::SpacePointsVector> & GetWeft() const { return _weft; }
|
||
/** \brief \ru Получить полилинии для главной нити основы.
|
||
\en Get a polyline for the main warp thread. \~
|
||
\details \ru Получить полилинии для главной нити основы.
|
||
Эти полилинии идут от точки приложения в положительном и отрицательном направлении
|
||
оси Х локальной системы координат.
|
||
\en Get a polyline for the main warp thread.
|
||
Polylines go in a positive and negative direction along the X-axis of the local coordinate system.
|
||
*/
|
||
std::vector<c3d::SpacePointsVector> & GetWarp() { return _warp; }
|
||
/** \brief \ru Получить полилинии для главной нити утка.
|
||
\en Get a polyline for the main weft thread. \~
|
||
\details \ru Получить полилинии для главной нити утка.
|
||
Эти полилинии идут от точки приложения в положительном и отрицательном направлении
|
||
оси Y локальной системы координат.
|
||
\en Get a polyline for the main weft thread.
|
||
Polylines go in a positive and negative direction along the Y-axis of the local coordinate system.
|
||
*/
|
||
std::vector<c3d::SpacePointsVector> & GetWeft() { return _weft; }
|
||
/// \ru Получить полилинию для стороны ячейки. \en Get a cell side polyline.
|
||
const std::vector<c3d::SpacePointsVector> & GetCellSides() const { return _sides; }
|
||
/// \ru Получить полилинию для стороны ячейки. \en Get a cell side polyline.
|
||
std::vector<c3d::SpacePointsVector> & GetCellSides() { return _sides; }
|
||
/** \brief \ru Получить грань-развертку.
|
||
\en Get an unwrapped face. \~
|
||
\details \ru Получить грань-развертку.
|
||
Ее контур получается путем аппроксимации границы сеточной развертки.
|
||
\en Get an unwrapped face.
|
||
This is a contour calculated by an approximation of the unwrapped mesh border.
|
||
\param[in] tolApprox - \ru Точность аппроксимации.
|
||
\en An approximation tolerance. \~
|
||
\param[out] unwrapped - \ru Грань-развертка.
|
||
\en An unwrapped face. \~
|
||
*/
|
||
void GetUnwrapped( double tolApprox, c3d::FaceSPtr & unwrapped ) const;
|
||
/** \brief \ru Получить полилинию разреза ткани на поверхности оболочки.
|
||
\en Get a fiber cut polyline on the shell surface. \~
|
||
\details \ru Получить полилинию разреза ткани на поверхности оболочки.
|
||
\en Get a fiber cut polyline on the shell surface.
|
||
\param[in] uv - \ru Начало прямой - линии разреза.
|
||
\en A cut line beginning. \~
|
||
\param[in] dir - \ru Направление прямой - линии разреза.
|
||
\en A cut line direction. \~
|
||
\param[out] polys - \ru Полилинии - отображение линии разреза на оболочку.
|
||
\en Polylines represented a line mapping to the shell. \~
|
||
*/
|
||
void GetSplitPolylines( const MbCartPoint & uv, const MbVector & dir, std::vector<c3d::SpacePointsVector> & polys ) const;
|
||
|
||
// \ru Инициализировать атрибуты сетки. \en Initialize the mesh attributes. \~
|
||
void InitAttributes();
|
||
|
||
OBVIOUS_PRIVATE_COPY( MbDrapeShellResults );
|
||
};
|
||
|
||
#endif // __OP_POLYMESH_PARAMETERS_H
|