AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
T Mesh Spline Modeling

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.; // The size in x direction
double dy = 3.; // The size in y direction
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
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.

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
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; // The number of segments in rotation
size_t vseg = 4; // The number of segments in vertical
bool isTop = true;
bool isBottom = true;
// Construct a cylinder
AMCAX::TMS::TMSplineMakeCylinder mkCylinder(frame, radius, height, isTop, isBottom, rseg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCylinder.BuildSpline();
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; // The number of segments in rotation
size_t vseg = 4; // The number of segments in vertical
// Construct a cone
AMCAX::TMS::TMSplineMakeCone mkCone(radius, height, isBottom, rseg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCone.BuildSpline();
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.;// The bottom radius
double radius2 = 1.;// The top radius
double height = 2.;
bool isTop = true;
bool isBottom = true;
size_t rseg = 8;// The number of segments in rotation
size_t vseg = 4;// The number of segments in vertical
// Construct a cone frustum
AMCAX::TMS::TMSplineMakeCone mkCone(frame, radius1, radius2, height, isTop, isBottom, rseg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCone.BuildSpline();

Sphere

The AMCAX::TMS::TMSplineMakeSphere class is used to construct a sphere.

double radius = 10.;
size_t rseg = 8; // The number of segments in rotation
size_t vseg = 8; // The number of segments in vertical
// Construct a sphere
AMCAX::TMS::TMSplineMakeSphere mkSphere(radius, rseg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkSphere.BuildSpline();
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; // The number of segments in major rotation
size_t minorSeg = 16; // The number of segments in minor rotation
// Construct a torus
AMCAX::TMS::TMSplineMakeTorus mkTorus(majorRadius, minorRadius, majorSeg, minorSeg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkTorus.BuildSpline();
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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Get the vertices of the face in TMSpline
int face = 0; // The index of face
std::vector<int> index_v = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(tsp, face);
static AMCAX_API std::vector< int > FaceVertexIndexs(TMSpline *tsp, int face)
Return the vertices of the face in TMSpline.

Get vertex indices of a specified edge in TMSpline

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Get the vertices of the edge in TMSpline
int edge = 0; // The index of edge
int vfirst, vlast;
static AMCAX_API void EdgeVertexIndexs(TMSpline *tsp, int edge, int &vfirst, int &vlast)
Get the vertices of the edge in TMSpline.

Get all edge indices of a specified face in TMSpline

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Get the edge of the face in TMSpline
int face = 0; // The index of face
std::vector<int> index_e = AMCAX::TMS::TMSplineTool::FaceEdgeIndexs(tsp, face);
static AMCAX_API std::vector< int > FaceEdgeIndexs(TMSpline *tsp, int face)
Return the edge of the face in TMSpline.

Get indices of faces adjacent to a specified edge in TMSpline

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Get the faces adjacent to edge in TMSpline
int edge = 0; // The index of edge
std::vector<int> index_f = AMCAX::TMS::TMSplineTool::EdgeFaceIndexs(tsp, edge);
static AMCAX_API std::vector< int > EdgeFaceIndexs(TMSpline *tsp, int edge)
Return the faces adjacent to edge in TMSpline.

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.; // The size in x direction
double dy = 10.; // The size in y direction
size_t useg = 2; // The number of segments in x direction
size_t vseg = 2; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Add a single face to a TMSpline
AMCAX::Point3 p1(12., 15., 15.);
AMCAX::Point3 p2(16., 13., 11.);
AMCAX::Point3 p3(20., 18., 13.);
std::vector<AMCAX::Point3> vlist = { p1, p2, p3 }; // The points for constructing face
if (addface.CanAddSingleFace(tsp, vlist))
{
addface.AddSingleFace(tsp, vlist);
}
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.; // The size in x direction
double dy = 10.; // The size in y direction
size_t useg = 2; // The number of segments in x direction
size_t vseg = 2; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Add a single face to a TMSpline
int e1index = 0; // The first edge
int e2index = 3; // The second edge
if (addface.CanAddFaceByEdge(tsp, e1index, e2index))
{
addface.AddFaceByEdge(tsp, e1index, e2index);
}
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Split a loop faces generated from edge
size_t eid = 4;
double t = 0.5;
if (split.CanSplitFaceLoop(tsp, eid, t))
{
split.SplitFaceLoop(tsp, eid, t);
}
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Split faces by 1-4 split method
std::vector<int> flist = { 3, 8 }; // The faces that need to be split
if (split.CanSplitFacesCross(tsp, flist))
{
split.SplitFacesCross(tsp, flist);
}
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Split faces by sequentially crossing the point of the edges in TMSpline
std::vector<int> elist = { 0 }; // The edges that need to be sequentially crossed
std::vector<AMCAX::Point3> newControl = { AMCAX::Point3(2.0, 1.0, 0.0) };
if (split.CanSplitFaceWithEdge(tsp, elist, newControl))
{
split.SplitFaceWithEdge(tsp, elist, newControl);
}
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Split faces by sequentially crossing vertices in TMSpline
std::vector<int> vlist = { 5, 10 }; // The vertices that need to be sequentially crossed
if (split.CanSplitFaceWithVertex(tsp, vlist))
{
split.SplitFaceWithVertex(tsp, vlist);
}
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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 2; // The number of segments in x direction
size_t segY = 2; // The number of segments in y direction
size_t segZ = 2; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Remove vertices in a TMSpline
std::vector<int> vlist = { 0, 1 }; // The vertices that need to be removed
if (reduce.CanRemoveVertices(tsp, vlist))
{
reduce.RemoveVertices(tsp, vlist);
}
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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 2; // The number of segments in x direction
size_t segY = 2; // The number of segments in y direction
size_t segZ = 2; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Remove edges in a TMSpline
const std::vector<int> elist = { 10, 15 }; // The edges that need to be removed
if (reduce.CanRemoveEdges(tsp, elist))
{
reduce.RemoveEdges(tsp, elist);
}
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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 2; // The number of segments in x direction
size_t segY = 2; // The number of segments in y direction
size_t segZ = 2; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Delete faces in a TMSpline
const std::vector<int> flist = { 2, 6 }; // The faces that need to be deleted
if (reduce.CanDeleteFaces(tsp, flist))
{
reduce.DeleteFaces(tsp, flist);
}
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.

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Separate
std::vector<int> elist = { 11, 17 }; // The edges that need to separate
separate.SeparateEdges(tsp, 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...

Welding

The AMCAX::TMS::TMSplineWeld class provides welding functions.

Weld two specified edges

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Separate
std::vector<int> elist = { 11, 17 }; // The edges that need to separate
separate.SeparateEdges(tsp, elist);
// Weld two edges
int e1 = 17; // The first edge
int e2 = 109; // The second edge
if (weld.CanWeldTwoEdge(tsp, e1, e2))
{
weld.WeldTwoEdge(tsp, e1, e2);
}
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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Separate
std::vector<int> elist = { 11, 17 }; // The edges that need to separate
separate.SeparateEdges(tsp, elist);
// Weld edges
std::vector<int> elist_weld = { 11, 17, 108, 109 }; // The edges that need to be welded
double tolerance = 0.01;
if (weld.CanWeldEdges(tsp, elist_weld))
{
weld.WeldEdges(tsp, elist_weld, tolerance);
}
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.

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Set the transformation as the translation
double h = 30;
AMCAX::Vector3 vec(frame.Direction().Coord() * h);
trsfMove.SetTranslation(vec);
trsfV.SetTransformation(trsfMove);
// Apply transformations to vertex list in a TMSpline
std::vector<int> vlist = { 0, 1, 2 };
trsfV.TransformTMSplineVertices(tsp, vlist);
// Apply transformations to edge list in a TMSpline
std::vector<int> elist = { 14, 15, 16 };
trsfV.TransformTMSplineEdges(tsp, elist);
// Apply transformations to face list in a TMSpline
std::vector<int> flist = { 27, 28, 29 };
trsfV.TransformTMSplineFaces(tsp, flist);
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
Class of transforming a TMSpline, change the input and post processing required after transforming th...
Definition TMSplineTransform.hpp:15
AMCAX_API void TransformTMSplineFaces(TMSpline *tsp, const std::vector< int > &flist)
Applying transformations to face list in a TMSpline.
AMCAX_API void SetTransformation(const Transformation3 &t)
Set the Transformation to be applied.
AMCAX_API void TransformTMSplineEdges(TMSpline *tsp, const std::vector< int > &elist)
Applying transformations to edge list in a TMSpline.
AMCAX_API void TransformTMSplineVertices(TMSpline *tsp, const std::vector< int > &vlist)
Applying transformations to vert list in a TMSpline.
constexpr void SetTranslation(const VectorT< OtherScalar, DIM > &vec) noexcept
Set the transformation as the translation.
Definition TransformationT.hpp:311
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.; // The size in x direction
double dy = 3.; // The size in y direction
size_t useg = 1; // The number of segments in x direction
size_t vseg = 1; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Extrude the edges in TMSpline
std::vector<int> edgeid = { 0, 1, 2 };
std::vector<int> edgeid_new; // Indices of the edges after extrusion
if (extrude.CanExtrudeEdges(tsp, edgeid))
{
extrude.ExtrudeEdges(tsp, edgeid, 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

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Extrude the faces in TMSpline
std::vector<int> faceid = { 0, 2, 5 };
std::vector<int> faceid_new; // Indices of the faces after extrusion
if (extrude.CanExtrudeFaces(tsp, faceid))
{
extrude.ExtrudeFaces(tsp, faceid, 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.; // The size in x direction
double dy = 3.; // The size in y direction
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Thicken a TMSpline
double dist = 1.;
thicken.ThickenTMSpline(tsp, dist);
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.; // The size in x direction
double dy = 3.; // The size in y direction
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(frame, dx, dy, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Offset a TMSpline
double dist = 1.;
AMCAX::TMS::TMSpline* tsp_offset = offset.OffsetTMSpline(tsp, dist);
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Delete faces in a TMSpline
std::vector<int> flist = { 4 };
reduce.DeleteFaces(tsp, flist);
// Fill hole with input edge
size_t edgeid = 6;
if (fillhole.CanFillSingleHole(tsp, edgeid))
{
fillhole.FillSingleHole(tsp, edgeid);
}
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

AMCAX::Point2 p0(1., 1.); // The min corner point
AMCAX::Point2 p1(10., 10.); // The max corner point
size_t useg = 3; // The number of segments in x direction
size_t vseg = 3; // The number of segments in y direction
// Construct a rectangle
AMCAX::TMS::TMSplineMakeRectangle mkRect(p0, p1, useg, vseg);
// Build and get the result TMSpline
AMCAX::TMS::TMSpline* tsp = mkRect.BuildSpline();
// Delete faces in a TMSpline
std::vector<int> flist = { 0, 6 };
reduce.DeleteFaces(tsp, flist);
// Fill all holes in TMSpline
fillhole.FillAllHoles(tsp);
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.

// Construct a cube
AMCAX::Point3 Pmin(0., 0., 0.);// The min corner point
AMCAX::Point3 Pmax(12., 12., 12.);// The max corner point
size_t segX = 3;// The number of segments in x direction
size_t segY = 3;// The number of segments in y direction
size_t segZ = 3;// The number of segments in z direction
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
// Convert to NURBS surfaces
std::vector<std::shared_ptr<TMBSplineSurface>> surfaces = tonurbs.GetGeom();
// Build faces and add to shell
TopoBuilder builder;
TopoShell shell;
builder.MakeShell(shell);
for (size_t i = 0; i < surfaces.size(); ++i)
{
// Get all infomation of TMBSplineSurface
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);
// Construct a B spline face
auto bsp_surf = std::make_shared<Geom3BSplineSurface>(pts, w, uK, vK, uM, vM, uD, vD, uP, vP);
TopoFace face = MakeFace(bsp_surf, 1e-7);
// Add to a shell
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.

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Meshing
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
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.

AMCAX::Point3 Pmin(0., 0., 0.); // The min corner point
AMCAX::Point3 Pmax(12., 12., 12.); // The max corner point
size_t segX = 3; // The number of segments in x direction
size_t segY = 3; // The number of segments in y direction
size_t segZ = 3; // The number of segments in z direction
// Construct a cube
AMCAX::TMS::TMSplineMakeCube mkCube(Pmin, Pmax, segX, segY, segZ);
// Meshing
AMCAX::TMS::TMSpline* tsp = mkCube.BuildSpline();
tspMesh.UpdateDrawMesh();
// Export
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