Basic Body Construction
Basic bodies include planar rectangles, cubes, cylindrical bodies, conical bodies, frustums, spheres, tori, etc.
Planar Rectangle
The AMCAX::TMS::TMSplineMakeRectangle class is used to construct a planar rectangle.
double dx = 3.;
double dy = 3.;
size_t useg = 3;
size_t vseg = 3;
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
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:887
Cube
The AMCAX::TMS::TMSplineMakeCube class is used to construct a cube.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
Class of TMSpline API for make a cube.
Definition TMSplineMakeCube.hpp:15
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459
Cylinder
The AMCAX::TMS::TMSplineMakeCylinder class is used to construct a cylindrical body.
double radius = 1.;
double height = 4.;
size_t rseg = 8;
size_t vseg = 4;
bool isTop = true;
bool isBottom = true;
Class of TMSpline API for make a cylinder.
Definition TMSplineMakeCylinder.hpp:15
Cone
The AMCAX::TMS::TMSplineMakeCone class is used to construct a conical body.
double radius = 1.;
double height = 2.;
bool isBottom = true;
size_t rseg = 8;
size_t vseg = 4;
Class of TMSpline API for make a cone.
Definition TMSplineMakeCone.hpp:16
Frustum
The AMCAX::TMS::TMSplineMakeCone class is used to construct a frustum.
double radius1 = 2.;
double radius2 = 1.;
double height = 2.;
bool isTop = true;
bool isBottom = true;
size_t rseg = 8;
size_t vseg = 4;
Sphere
The AMCAX::TMS::TMSplineMakeSphere class is used to construct a sphere.
double radius = 10.;
size_t rseg = 8;
size_t vseg = 8;
Class of TMSpline API for make a sphere.
Definition TMSplineMakeSphere.hpp:15
Torus
The AMCAX::TMS::TMSplineMakeTorus class is used to construct a torus.
double majorRadius = 20.;
double minorRadius = 10.;
size_t majorSeg = 8;
size_t minorSeg = 16;
Class of TMSpline API for make a Torus.
Definition TMSplineMakeTorus.hpp:15
Basic Editing Functions
Basic editing functions include traversal, adding faces, refinement, deletion, separation, welding, etc.
Traversal
The AMCAX::TMS::TMSplineTool class provides traversal functions, as follows:
Get all vertex indices of a specified face in TMSpline
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
int face = 0;
Get vertex indices of a specified edge in TMSpline
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
int edge = 0;
int vfirst, vlast;
Get all edge indices of a specified face in TMSpline
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
int face = 0;
Get indices of faces adjacent to a specified edge in TMSpline
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
int edge = 0;
Adding Faces
The AMCAX::TMS::TMSplineAddFace class provides the function for adding faces.
Add a single face composed of a set of points to TMSpline
double dx = 10.;
double dy = 10.;
size_t useg = 2;
size_t vseg = 2;
std::vector<AMCAX::Point3> vlist = { p1, p2, p3 };
{
}
else
std::cout << "error" << std::endl;
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
Add a single face composed of two edges to TMSpline
double dx = 10.;
double dy = 10.;
size_t useg = 2;
size_t vseg = 2;
int e1index = 0;
int e2index = 3;
{
}
else
std::cout << "error" << std::endl;
AMCAX_API TFace * AddFaceByEdge(TMSpline *tsp, int e1index, int e2index)
add a single face constructed from two edges to a TMSpline
AMCAX_API bool CanAddFaceByEdge(TMSpline *tsp, int e1index, int e2index)
return true if it can add a single face constructed from two edges to a TMSpline
Split
The AMCAX::TMS::TMSplineSplit class provides refinement functions, as follows:
Split a toroidal face
size_t useg = 3;
size_t vseg = 3;
size_t eid = 4;
double t = 0.5;
{
}
else
std::cout << "error" << std::endl;
Class of TMSpline API for split spline.
Definition TMSplineSplit.hpp:14
AMCAX_API void SplitFaceLoop(TMSpline *tsp, size_t eId, double t=0.5)
Split a loop faces generated from edge.
AMCAX_API bool CanSplitFaceLoop(TMSpline *tsp, size_t eId, double t=0.5)
return true if a loop faces generated from edge in TMSpline can be splited
PointT< double, 2 > Point2
2D point
Definition PointT.hpp:456
1-4 split method to split faces
size_t useg = 3;
size_t vseg = 3;
std::vector<int> flist = { 3, 8 };
{
}
else
std::cout << "error" << std::endl;
AMCAX_API bool CanSplitFacesCross(TMSpline *tsp, const std::vector< int > &flist)
return true if faces in TMSpline can be 1-4 split
AMCAX_API void SplitFacesCross(TMSpline *tsp, std::vector< int > &flist)
Split faces by 1-4 split method.
Split face along an edge
size_t useg = 3;
size_t vseg = 3;
std::vector<int> elist = { 0 };
std::vector<AMCAX::Point3> newControl = {
AMCAX::Point3(2.0, 1.0, 0.0) };
{
}
else
std::cout << "error" << std::endl;
AMCAX_API void SplitFaceWithEdge(TMSpline *tsp, std::vector< int > &elist, const std::vector< Point3 > &newControl)
Split faces by sequentially cross the point of the edges in TMSpline.
AMCAX_API bool CanSplitFaceWithEdge(TMSpline *tsp, const std::vector< int > &elist, const std::vector< Point3 > &newControl)
return true if can split faces by sequentially cross the point of the edges in TMSpline
Split face along vertices
size_t useg = 3;
size_t vseg = 3;
std::vector<int> vlist = { 5, 10 };
{
}
else
std::cout << "error" << std::endl;
AMCAX_API bool CanSplitFaceWithVertex(TMSpline *tsp, std::vector< int > &vlist)
return true if can split faces by sequentially cross vertices in TMSpline
AMCAX_API void SplitFaceWithVertex(TMSpline *tsp, std::vector< int > &vlist)
Split faces by sequentially cross vertices in TMSpline.
Deletion
The AMCAX::TMS::TMSplineReduce class provides deletion functions, as follows:
Remove vertices from TMSpline
size_t segX = 2;
size_t segY = 2;
size_t segZ = 2;
std::vector<int> vlist = { 0, 1 };
{
}
else
std::cout << "error" << std::endl;
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 TMSpline
size_t segX = 2;
size_t segY = 2;
size_t segZ = 2;
const std::vector<int> elist = { 10, 15 };
{
}
else
std::cout << "error" << std::endl;
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.
Delete faces from TMSpline
size_t segX = 2;
size_t segY = 2;
size_t segZ = 2;
const std::vector<int> flist = { 2, 6 };
{
}
else
std::cout << "error" << std::endl;
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
The AMCAX::TMS::TMSplineSeparate class provides separation functions.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
std::vector<int> elist = { 11, 17 };
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...
Welding
The AMCAX::TMS::TMSplineWeld class provides welding functions.
Weld two specified edges
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
std::vector<int> elist = { 11, 17 };
int e1 = 17;
int e2 = 109;
{
}
else
std::cout << "error" << std::endl;
Class of TMSpline API for weld edges.
Definition TMSplineWeld.hpp:14
AMCAX_API bool CanWeldTwoEdge(TMSpline *tsp, int e1, int e2)
return true if two edge in a TMSpline can be weld
AMCAX_API bool WeldTwoEdge(TMSpline *tsp, int e1, int e2)
Weld two edges in a TMSpline to one inner edge.
Weld edges within a tolerance range
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
std::vector<int> elist = { 11, 17 };
std::vector<int> elist_weld = { 11, 17, 108, 109 };
double tolerance = 0.01;
{
}
else
std::cout << "error" << std::endl;
AMCAX_API bool WeldEdges(TMSpline *tsp, const std::vector< int > &elist, double tolerance=0.01)
find all edges in a TMSpline by input edges with tolerance and Weld them to inner edges
AMCAX_API bool CanWeldEdges(TMSpline *tsp, const std::vector< int > &elist)
return true if edges in a TMSpline can be weld
Topological Modeling Functions
Topological modeling functions include transformation, extrusion, thickening, filling holes, etc.
Transformation
The AMCAX::TMS::TMSplineTransform class provides transformation functions. It supports transforming vertex lists, edge lists, and face lists in TMSpline.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
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
Get the intrinsic coordinate of the direction.
Definition DirectionT.hpp:186
constexpr const DirectionT< Scalar, DIM > & Direction() const noexcept
Get the main direction (z direction) in 3D.
Definition FrameT.hpp:443
TransformationT< double, 3 > Transformation3
3D transformation
Definition TransformationT.hpp:1115
VectorT< double, 3 > Vector3
3D vector
Definition VectorT.hpp:707
Extrusion
The AMCAX::TMS::TMSplineExtrude class provides extrusion functions. It supports extruding edges and faces.
Extrude edges
Edges to be extruded must be boundary edges. You can check the input edges using AMCAX::TMS::TMSplineCheck::IsEdgeBoundary.
double dx = 3.;
double dy = 3.;
size_t useg = 1;
size_t vseg = 1;
std::vector<int> edgeid = { 0, 1, 2 };
std::vector<int> edgeid_new;
{
}
else
std::cout << "error" << std::endl;
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 faces
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
std::vector<int> faceid = { 0, 2, 5 };
std::vector<int> faceid_new;
{
}
else
std::cout << "error" << std::endl;
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
Thickening and Offsetting
The AMCAX::TMS::TMSplineThicken class provides functions for thickening and offsetting.
Thickening
double dx = 3.;
double dy = 3.;
size_t useg = 3;
size_t vseg = 3;
double dist = 1.;
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.
Offsetting
double dx = 3.;
double dy = 3.;
size_t useg = 3;
size_t vseg = 3;
double dist = 1.;
AMCAX_API TMSpline * OffsetTMSpline(const TMSpline *tsp, double dist)
Offset a TMSpline to obtain a new TMSpline.
Filling Holes
The AMCAX::TMS::TMSplineFillHole class provides functions for filling holes. It supports filling holes containing specified edges or all holes in TMSpline. Note that for an open mesh, filling holes will also treat the boundary as a hole and fill it with a polygon.
Fill holes in TMSpline containing specified edges
size_t useg = 3;
size_t vseg = 3;
std::vector<int> flist = { 4 };
size_t edgeid = 6;
{
}
else
std::cout << "error" << std::endl;
Class of TMSpline API for fill hole.
Definition TMSplineFillHole.hpp:15
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
Fill all holes in TMSpline
size_t useg = 3;
size_t vseg = 3;
std::vector<int> flist = { 0, 6 };
AMCAX_API bool FillAllHoles(TMSpline *tsp)
fill all holes in TMSpline by use a singel polygon face
Conversion Function
The AMCAX::TMS::TMSplineToNURBS class is used to convert T-splines to NURBS.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
std::vector<std::shared_ptr<TMBSplineSurface>> surfaces = tonurbs.GetGeom();
TopoBuilder builder;
TopoShell shell;
builder.MakeShell(shell);
for (size_t i = 0; i < surfaces.size(); ++i)
{
const auto& surf = surfaces[i];
Array2<Point3> pts;
Array2<double> w;
std::vector<double> uK, vK;
std::vector<int> uM, vM;
int uD, vD;
bool uP, vP;
surf->GetInfo(pts, w, uK, vK, uM, vM, uD, vD, uP, vP);
auto bsp_surf = std::make_shared<Geom3BSplineSurface>(pts, w, uK, vK, uM, vM, uD, vD, uP, vP);
TopoFace face = MakeFace(bsp_surf, 1e-7);
builder.Add(shell, face);
}
Transforms a T-spline into a NURBS representation.
Definition TMSplineToNURBS.hpp:19
Meshing
The AMCAX::TMS::TMSplineMeshing class is used to partition TMSpline into triangular meshes.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
tspMesh.UpdateDrawMesh();
Class of meshing a TMSpline to a Triangle mesh.
Definition TMSplineMeshing.hpp:19
Exporting
The AMCAX::TMS::TMSplineMeshingIO class provides functionality for exporting files. It supports exporting to OBJ/STL files.
size_t segX = 3;
size_t segY = 3;
size_t segZ = 3;
tspMesh.UpdateDrawMesh();
std::string fileNameOBJ = "e_cube.obj";
std::string fileNameSTL = "e_cube.stl";
meshIO.
ExportToOBJ(fileNameOBJ, tspMesh.GetDrawMesh());
meshIO.
ExportToSTL(fileNameSTL, tspMesh.GetDrawMesh());
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
AMCAX_API bool ExportToSTL(const std::string &filename, const TMSTriangleMesh *tmsMesh) const
export a TMSpline triangle mesh to a stl file