本文主要是介绍[G+smo] gsMultiPatch 类,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1. gsMultiPatch类
gsMultiPatch类的继承关系
重要函数
得到几何信息:
/// Dimension of the parameter domain (must match for all patches).
int parDim() const
int parDim() const
/// Dimension of the geometry (must match for all patches).
int geoDim() const;
int geoDim() const;
/// Number of patches
std::size_t nPatches() const { return m_patches.size(); }
std::size_t nPatches() const { return m_patches.size(); }
得到patch和geometry:
/// Return the \a i-th patch.
gsGeometry<T>& patch( std::size_t i ) const
gsGeometry<T>& patch( std::size_t i ) const
/// Return the basis of the \a i-th patch.
gsBasis<T> & basis( std::size_t i ) const;
gsBasis<T> & basis( std::size_t i ) const;
/// Returns the range of parameter
gsMatrix<T> parameterRange(int i = 0) const;
/// Number of patches
std::size_t nPatches() const { return m_patches.size(); }
/// Returns a vector of patches // to do : replace by copies
PatchContainer const& patches() const { return m_patches; }
/// Return the \a i-th patch.
const gsGeometry<T> & operator []( size_t i ) const { return *m_patches[i]; }
/// Makes a deep copy of all bases and puts them in a vector
std::vector<gsBasis<T> *> basesCopy() const;
修改几何:
/// Add a patch.
void addPatch( gsGeometry<T> * g );
/// Search for the given geometry and return its patch index.
int findPatchIndex( gsGeometry<T>* g ) const;
gsMatrix<T> parameterRange(int i = 0) const;
/// Number of patches
std::size_t nPatches() const { return m_patches.size(); }
/// Returns a vector of patches // to do : replace by copies
PatchContainer const& patches() const { return m_patches; }
/// Return the \a i-th patch.
const gsGeometry<T> & operator []( size_t i ) const { return *m_patches[i]; }
/// Makes a deep copy of all bases and puts them in a vector
std::vector<gsBasis<T> *> basesCopy() const;
修改几何:
/// Add a patch.
void addPatch( gsGeometry<T> * g );
/// Search for the given geometry and return its patch index.
int findPatchIndex( gsGeometry<T>* g ) const;
/// Add boundary
void addPatchBoundary( gsGeometry<T>* g, boxSide s )
///几何的细化和升阶
void uniformRefine(int numKnots = 1, int mul = 1);
void degreeElevate(int elevationSteps = 1);
void degreeElevate(int elevationSteps = 1);
/// Attempt to compute interfaces and boundaries automatically. 几何类的计算
bool computeTopology( T tol = 1e-4 );
bool computeTopology( T tol = 1e-4 );
///初始化
/// Clear (delete) all patches
void clear()
void clear()
重要变量
2. 使用示范
声明和定义
gsMultiPatch的声明:gsMultiPatch<> * patches;
gsMultiPatch的定义:patches = gsNurbsCreator<>::BSplineSquareGrid(1, 1, 2, -1,-1); 定义一个 1×1 NURBS片,每个片的边长为2,左下侧点坐标为(-1,-1)。
升阶和细化
patches->patch(0).degreeElevate(1);
for (int i = 0; i < numRefine; ++i)
patches->patch(0).uniformRefine();
patches->patch(0).uniformRefine();
patches->degreeElevate(1);
for (int i = 0; i < numRefine; ++i)
patches->uniformRefine();
for (int i = 0; i < numRefine; ++i)
patches->uniformRefine();
控制点
gsMultiPatch<> * patches = gsNurbsCreator<>::BSplineSquareGrid(2, 2, 1, -1,-1);
//Scaling
//for ( size_t i = 0; i<patches->nPatches(); ++i)
// patches->patch(i).coefs().array() /= 10.0;
//gsWrite(*patches,"scaledpatches");
//for ( size_t i = 0; i<patches->nPatches(); ++i)
// patches->patch(i).coefs().array() /= 10.0;
//gsWrite(*patches,"scaledpatches");
附录
头文件:stable\src\gsCore\gs\gsMultiPatch.h
这篇关于[G+smo] gsMultiPatch 类的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!