Basic Geometry Construction
Basic geometries include planar rectangle, cube, cylinder, cone, truncated cone, sphere, torus, and others.
TMSplineMakeRectangle(Planar Rectangle)
Class of TMSpline structure The Low Level API functions are not exported for this version.
Definition: TMSpline.hpp:30
Class of TMSpline API for make a plane rectangle.
Definition: TMSplineMakeRectangle.hpp:15
TMSplineMakeCube(Cube)
Class of TMSpline API for make a cube.
Definition: TMSplineMakeCube.hpp:15
TMSplineMakeCylinder(Cylinder)
Class of TMSpline API for make a cylinder.
Definition: TMSplineMakeCylinder.hpp:15
TMSplineMakeCone(Cone)
Class of TMSpline API for make a cone.
Definition: TMSplineMakeCone.hpp:16
TMSplineMakeCone(Truncated Cone)
TMSplineMakeSphere(Sphere)
Class of TMSpline API for make a sphere.
Definition: TMSplineMakeSphere.hpp:15
TMSplineMakeTorus(Torus)
Class of TMSpline API for make a Torus.
Definition: TMSplineMakeTorus.hpp:15
Basic Edit Function
Basic edit function include traversal, add faces, split, deletion, separation, and weld.
Traversal
The AMCAX::TMS::TMSplineTool class provides traversal functions, as detailed below:
AMCAX::TMS::TMSplineTool::FaceVertexIndexs get all vertex indices of a specific face in the TMSpline;
AMCAX::TMS::TMSplineTool::EdgeVertexIndexs get vertex indices of a specific edge in the TMSpline;
AMCAX::TMS::TMSplineTool::FaceEdgeIndexs get all edge indices of a specific face in the TMSpline;
AMCAX::TMS::TMSplineTool::EdgeFaceIndexs get indices of faces adjacent to the specified edge in the TMSpline.
Get all vertex indices of a specific face in the TMSpline
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int face = 0;
Get vertex indices of a specific edge in the 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;
Get all edge indices of a specific face in the TMSpline
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int face = 0;
Get indices of faces adjacent to a specified edge in the TMSpline
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
int edge = 0;
Add Face
The AMCAX::TMS::TMSplineAddFace class provides add functionality. AMCAX::TMS::TMSplineAddFace::AddSingleFace adds a single face composed of a set of points to a TMSpline; AMCAX::TMS::TMSplineAddFace::AddFaceByEdge adds a single face composed of two edges to a TMSpline. In addition, AMCAX::TMS::TMSplineAddFace::CanAddSingleFace or AMCAX::TMS::TMSplineAddFace::CanAddFaceByEdge can be used to determine whether a face can be added successfully or not before adding.
Add a single face defined by a set of points to the 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.
Definition: 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.
Definition: TMSplineMeshing.hpp:19
Class of export TMSpline triangle mesh to STL or OBJ format.
Definition: TMSplineMeshingIO.hpp:16
AMCAX_API bool ExportToOBJ(const std::string &filename, const TMSTriangleMesh *tmsMesh) const
export a TMSpline triangle mesh to a obj file
Add a single face defined by two edges to the TMSpline
To be down.
Split
AMCAX::TMS::TMSplineSplit class provides split functions.
To be down.
Deletion
AMCAX::TMS::TMSplineReduce class provides deletion functions. The specific functions are:
AMCAX::TMS::TMSplineReduce::RemoveVertices removes vertices from the TMSpline (edges connected to those vertices are also deleted);
AMCAX::TMS::TMSplineReduce::RemoveEdges removes edges from the TMSpline;
AMCAX::TMS::TMSplineReduce::DeleteFaces removes faces from the TMSpline.
Before deletion, you can check if it's possible to remove vertices/edges/faces using AMCAX::TMS::TMSplineReduce::CanRemoveVertices, AMCAX::TMS::TMSplineReduce::CanRemoveEdges, or AMCAX::TMS::TMSplineReduce::CanDeleteFaces.
Remove vertices from the TMSpline
std::vector< int >vlist = { 0,1};
Class of TMSpline API for delete and remove element Deleting an element will leave a hole,...
Definition: 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
Remove edges from the 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.
Remove faces from the 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.
Separation and Weld
AMCAX::TMS::TMSplineSeparate class provides separation functions, and the AMCAX::TMS::TMSplineWeld class provides weld functions.
std::vector< int >elist = { 0 };
we.WeldEdges(tsp1, elist);
Class of TMSpline API for separate edge, obtain new boundaries in the separated edges.
Definition: 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.
Definition: TMSplineWeld.hpp:14
AMCAX_API bool CanWeldEdges(TMSpline *tsp, const std::vector< int > &elist)
return true if edges in a TMSpline can be weld
Topological Modeling Function
Topological modeling functions include transformation, extrusion, thicken, hole fill, and others.
Transformation
The AMCAX::TMS::TMSplineTransform class provides transformation functions. AMCAX::TMS::TMSplineTransform::TransformTMSplineVertices transforms the list of vertices in the TMSpline; AMCAX::TMS::TMSplineTransform::TransformTMSplineEdges transforms the list of edges in the TMSpline; AMCAX::TMS::TMSplineTransform::TransformTMSplineFaces transforms the list of faces in the 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 };
const CoordType & Coord() const
Get the intrinsic coordinate of the direction.
Definition: DirectionT.hpp:212
const DirectionT< Scalar, DIM > & Direction() const
Get the main direction (z direction) in 3D.
Definition: FrameT.hpp:397
Extrusion
The AMCAX::TMS::TMSplineExtrude class provides extrusion functions. AMCAX::TMS::TMSplineExtrude::ExtrudeEdges is used to extrude edges; AMCAX::TMS::TMSplineExtrude::ExtrudeFaces is used to extrude faces.
Extrude Edge
Note that the edges to be extruded must be boundary edges.
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...
Definition: 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
Extrude Face
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
Thicken
Class of TMSpline API for Thicken a TMSpline.
Definition: TMSplineThicken.hpp:14
AMCAX_API bool ThickenTMSpline(TMSpline *tsp, double dist)
Thicken a TMSpline to obtain a new TMSpline.
Hole Fill
The AMCAX::TMS::TMSplineFillHole class provides hole filling functions. AMCAX::TMS::TMSplineFillHole::FillAllHoles is used to fill a specific hole in a TMSpline; before filling hole, AMCAX::TMS::TMSplineFillHole::CanFillSingleHole can be used to check if a hole can be filled; AMCAX::TMS::TMSplineFillHole::FillAllHoles is used to fill all holes in the TMSpline. Note that for an open mesh, during hole filling, the boundary will also be considered a hole and filled with a polygon.
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.
Definition: 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
Meshing
AMCAX::TMS::TMSplineMeshing class divides the TMSpline into triangular meshes.
AMCAX::Point3 bb_min(0.00, 0.00, 0.00), bb_max(12.00, 12.00, 12.00);
tspMesh.UpdateDrawMesh();
Export OBJ/STL File
AMCAX::TMS::TMSplineMeshingIO::ExportToOBJ provides the function to export to OBJ files; AMCAX::TMS::TMSplineMeshingIO::ExportToSTL provides the function to export to STL files.
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