基本体构建
基本体包括平面矩形、立方体、圆柱体、圆锥体、圆台、球体、环面等。
TMSplineMakeRectangle(平面矩形)
Class of TMSpline structure The Low Level API functions are not exported for this version
定义 TMSpline.hpp:30
Class of TMSpline API for make a plane rectangle
定义 TMSplineMakeRectangle.hpp:15
FrameT< double, 3 > Frame3
三维标架
定义 FrameT.hpp:885
TMSplineMakeCube(立方体)
Class of TMSpline API for make a cube
定义 TMSplineMakeCube.hpp:15
PointT< double, 3 > Point3
三维点
定义 PointT.hpp:459
TMSplineMakeCylinder(圆柱体)
Class of TMSpline API for make a cylinder
定义 TMSplineMakeCylinder.hpp:15
TMSplineMakeCone(圆锥体)
Class of TMSpline API for make a cone
定义 TMSplineMakeCone.hpp:16
TMSplineMakeCone(圆台)
TMSplineMakeSphere(球体)
Class of TMSpline API for make a sphere
定义 TMSplineMakeSphere.hpp:15
TMSplineMakeTorus(环面)
Class of TMSpline API for make a Torus
定义 TMSplineMakeTorus.hpp:15
基本编辑功能
基本编辑功能包括遍历、添加面、细化、删除、分离、缝合等。
遍历
AMCAX::TMS::TMSplineTool 类提供遍历功能,具体如下:
AMCAX::TMS::TMSplineTool::FaceVertexIndexs 获取 TMSpline 中某个面所有顶点的索引;
AMCAX::TMS::TMSplineTool::EdgeVertexIndexs 获取 TMSpline 中某条边顶点的索引;
AMCAX::TMS::TMSplineTool::FaceEdgeIndexs 获取 TMSpline 中某个面所有边的索引;
AMCAX::TMS::TMSplineTool::EdgeFaceIndexs 获取 TMSpline 中与输入边相邻的面的索引。
获取 TMSpline 中某个面所有顶点的索引
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int face = 0;
获取 TMSpline 中某条边顶点的索引
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int edge = 0;
int vfirst, vlast;
获取 TMSpline 中某个面所有边的索引
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int face = 0;
获取 TMSpline 中与输入边相邻的面的索引
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int edge = 0;
添加面
AMCAX::TMS::TMSplineAddFace 类提供添加功能。其中 AMCAX::TMS::TMSplineAddFace::AddSingleFace 为 TMSpline 添加由点集构成的单个面; AMCAX::TMS::TMSplineAddFace::AddFaceByEdge 为 TMSpline 添加由两条边构成的单个面。另外在添加前可以通过 AMCAX::TMS::TMSplineAddFace::CanAddSingleFace 或 AMCAX::TMS::TMSplineAddFace::CanAddFaceByEdge 来判断能否成功添加面。
为 TMSpline 添加由点集构成的单个面
std::vector< AMCAX::Point3 > vlist = { p1,p2,p3 };
std::cout << r1 << std::endl;
tspMesh1.UpdateDrawMesh();
std::string fileNameOBJ1 = "AddSingleFace.obj";
meshIO1.
ExportToOBJ(fileNameOBJ1, tspMesh1.GetDrawMesh());
Class of TMSpline API for Adding faces
定义 TMSplineAddFace.hpp:15
AMCAX_API TFace * AddSingleFace(TMSpline *tsp, const std::vector< Point3 > &vplist)
add a single face constructed from points to a TMSpline
AMCAX_API bool CanAddSingleFace(TMSpline *tsp, const std::vector< Point3 > &vplist)
return true if it can add a single face constructed from points to a TMSpline
Class of meshing a TMSpline to a Triangle mesh
定义 TMSplineMeshing.hpp:19
Class of export TMSpline triangle mesh to STL or OBJ format
定义 TMSplineMeshingIO.hpp:16
AMCAX_API bool ExportToOBJ(const std::string &filename, const TMSTriangleMesh *tmsMesh) const
export a TMSpline triangle mesh to a obj file
为 TMSpline 添加由两条边构成的单个面
建设中。
细化
AMCAX::TMS::TMSplineSplit 类提供细化功能。
建设中。
删除
AMCAX::TMS::TMSplineReduce 类提供删除功能。具体如下:
AMCAX::TMS::TMSplineReduce::RemoveVertices 用于删除 TMSpline 中的顶点(也会删除连接顶点的边);
AMCAX::TMS::TMSplineReduce::RemoveEdges 用于删除 TMSpline 中的边;
AMCAX::TMS::TMSplineReduce::DeleteFaces 用于删除 TMSpline 中的面。
另外在删除前,可以通过 AMCAX::TMS::TMSplineReduce::CanRemoveVertices 、 AMCAX::TMS::TMSplineReduce::CanRemoveEdges 、 AMCAX::TMS::TMSplineReduce::CanDeleteFaces 来判断能否删除顶点/边/面。
删除 TMSpline 中的顶点
std::vector< int >vlist = { 0,1};
Class of TMSpline API for delete and remove element Deleting an element will leave a hole,...
定义 TMSplineReduce.hpp:15
AMCAX_API void RemoveVertices(TMSpline *tsp, const std::vector< int > &vlist)
Remove vertices in a TMSpline, it will also remove edges which connect to vertices
AMCAX_API bool CanRemoveVertices(TMSpline *tsp, const std::vector< int > &vlist)
return true if it can remove vertices in a TMSpline
删除 TMSpline 中的边
const std::vector< int > elist = { 10,15};
AMCAX_API bool CanRemoveEdges(TMSpline *tsp, const std::vector< int > &elist)
return true if it can remove edges in a TMSpline
AMCAX_API void RemoveEdges(TMSpline *tsp, const std::vector< int > &elist)
Remove edges in a TMSpline
删除 TMSpline 中的面
const std::vector< int > flist = { 2,6};
AMCAX_API bool CanDeleteFaces(TMSpline *tsp, const std::vector< int > &flist)
return true if it can delete faces in a TMSpline
AMCAX_API void DeleteFaces(TMSpline *tsp, const std::vector< int > &flist)
Delete faces in a TMSpline
分离和缝合
AMCAX::TMS::TMSplineSeparate 类提供分离功能; AMCAX::TMS::TMSplineWeld 类提供缝合功能。
std::vector< int >elist = { 0 };
we.WeldEdges(tsp1, elist);
Class of TMSpline API for separate edge, obtain new boundaries in the separated edges
定义 TMSplineSeparate.hpp:14
AMCAX_API bool SeparateEdges(TMSpline *tsp, const std::vector< int > &elist)
Separate edges into each other, the result edges will remain on top of each other until they are move...
Class of TMSpline API for weld edges
定义 TMSplineWeld.hpp:14
AMCAX_API bool CanWeldEdges(TMSpline *tsp, const std::vector< int > &elist)
return true if edges in a TMSpline can be weld
拓扑建模功能
拓扑建模功能包括变换、拉伸、加厚、补洞等。
变换
AMCAX::TMS::TMSplineTransform 类提供变换功能。其中 AMCAX::TMS::TMSplineTransform::TransformTMSplineVertices 对 TMSpline 中的顶点列表进行变换; AMCAX::TMS::TMSplineTransform::TransformTMSplineEdges 对 TMSpline 中的边列表进行变换; AMCAX::TMS::TMSplineTransform::TransformTMSplineFaces 对 TMSpline 中的面列表进行变换。
double h = 30;
std::vector< int > vlist = { 0,1,2 };
std::vector< int > elist = { 14,15,16 };
std::vector< int > flist = { 27,28,29 };
constexpr const CoordType & Coord() const noexcept
获取方向的内在坐标
定义 DirectionT.hpp:213
constexpr const DirectionT< Scalar, DIM > & Direction() const noexcept
获取三维主方向(z 方向)
定义 FrameT.hpp:441
TransformationT< double, 3 > Transformation3
三维变换
定义 TransformationT.hpp:1102
VectorT< double, 3 > Vector3
三维向量
定义 VectorT.hpp:707
拉伸
AMCAX::TMS::TMSplineExtrude 类提供拉伸功能。其中 AMCAX::TMS::TMSplineExtrude::ExtrudeEdges 用于拉伸边; AMCAX::TMS::TMSplineExtrude::ExtrudeFaces 用于拉伸面。
拉伸边
需要注意的是这里要进行拉伸的边需为边界边。
std::vector<int> edgeid = { 0,1,2 };
std::vector<int> edge_id_new;
static AMCAX_API bool IsEdgeBoundary(TMSpline *tsp, int eid)
check if the edge is boundary edge
Class of TMSpline API for extrude method only change the topology, the new result is coincide the old...
定义 TMSplineExtrude.hpp:15
AMCAX_API bool CanExtrudeEdges(TMSpline *tsp, const std::vector< int > &edges)
check if it can extrude input edges in TMSpline
AMCAX_API bool ExtrudeEdges(TMSpline *tsp, const std::vector< int > &edges, std::vector< int > &edgesNew)
extrude the edges in TMSpline
拉伸面
std::vector<int> faceid = { 0,2,5};
std::vector<int> face_id_new;
AMCAX_API bool CanExtrudeFaces(TMSpline *tsp, const std::vector< int > &faces)
check if it can extrude input faces in TMSpline
AMCAX_API bool ExtrudeFaces(TMSpline *tsp, const std::vector< int > &faces, std::vector< int > &facesNew)
extrude the faces in TMSpline
加厚
Class of TMSpline API for Thicken a TMSpline
定义 TMSplineThicken.hpp:14
AMCAX_API bool ThickenTMSpline(TMSpline *tsp, double dist)
Thicken a TMSpline to obtain a new TMSpline.
补洞
AMCAX::TMS::TMSplineFillHole 类提供补洞功能。其中 AMCAX::TMS::TMSplineFillHole::FillAllHoles 用于补 TMSpline 中某一个洞,在补洞前,可以先通过 AMCAX::TMS::TMSplineFillHole::CanFillSingleHole 来判断能否补; AMCAX::TMS::TMSplineFillHole::FillAllHoles 用于补 TMSpline 中所有的洞。需要注意的是,对于一个开网格,补洞时会把边界也当成洞并且用一个多边形填充起来。
std::vector<int> face_id = { 4 };
std::vector<int> edge_id = { 6, 10, 13, 14 };
std::vector<int> face_id2 = { 0,6 };
Class of TMSpline API for fill hole
定义 TMSplineFillHole.hpp:15
AMCAX_API bool FillAllHoles(TMSpline *tsp)
fill all holes in TMSpline by use a singel polygon face
AMCAX_API void FillSingleHole(TMSpline *tsp, size_t edgeIndex)
fill hole whit input edge by use a singel polygon face
AMCAX_API bool CanFillSingleHole(TMSpline *tsp, size_t edgeIndex)
check if there are hole with input edge in TMSpline
PointT< double, 2 > Point2
二维点
定义 PointT.hpp:456
网格化
AMCAX::TMS::TMSplineMeshing 类将 TMSpline 网格划分为三角形网格。
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
tspMesh.UpdateDrawMesh();
导出 OBJ/STL 文件
AMCAX::TMS::TMSplineMeshingIO::ExportToOBJ 提供导出 OBJ 文件的功能; AMCAX::TMS::TMSplineMeshingIO::ExportToSTL 提供导出 OBJ 文件的功能。
tspMesh4.UpdateDrawMesh();
std::string fileNameOBJ4 = "cube.obj";
std::string fileNameOBJ5 = "cube.stl";
meshIO4.
ExportToOBJ(fileNameOBJ4, tspMesh4.GetDrawMesh());
meshIO4.
ExportToSTL(fileNameOBJ5, tspMesh4.GetDrawMesh());
AMCAX_API bool ExportToSTL(const std::string &filename, const TMSTriangleMesh *tmsMesh) const
export a TMSpline triangle mesh to a stl file