Basic Shape Construction
Basic shape include plane rectangle, cube, cylinder, cone, truncated cone, sphere, torus, etc.
MeshMakeRectangle(Plane Rectangle)
Class of PolyMesh API for make a plane rectangle.
Definition MeshMakeRectangle.hpp:15
Class of TMSpline structure The Low Level API functions are not exported for this version.
Definition PolyMesh.hpp:23
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:885
MeshMakeCube(Cube)
Class of PolyMesh API for make a cube.
Definition MeshMakeCube.hpp:15
MeshMakeCylinder(Cylinder)
Class of PolyMesh API for make a cylinder.
Definition MeshMakeCylinder.hpp:15
MeshMakeCone(Cone)
Class of PolyMesh API for make a cone.
Definition MeshMakeCone.hpp:15
MeshMakeCone(Truncated Cone)
MeshMakeSphere(Sphere)
double r = 2.1;
Class of PolyMesh API for make a sphere.
Definition MeshMakeSphere.hpp:15
MeshMakeTorus(Torus)
Class of PolyMesh API for make a Torus.
Definition MeshMakeTorus.hpp:15
Basic Edit Feature
Basic edit feature include traversal, face addition, split, deletion, separation, and weld.
Traversal
AMCAX::SubD::MeshTool class provides traversal features, such as the following:
AMCAX::SubD::MeshTool::EdgeVertexIndexs is used to get the indices of the vertices of a specific edge in the PolyMesh;
AMCAX::SubD::MeshTool::FaceVertexIndexs is used to get the indices of all vertices of a specific face in the PolyMesh;
AMCAX::SubD::MeshTool::FaceEdgeIndexs is used to get the indices of all edges of a specific face in the PolyMesh;
AMCAX::SubD::MeshTool::EdgeFaceIndexs is used to get the indices of the faces adjacent to a given edge in the PolyMesh;
AMCAX::SubD::MeshTool::VertEdgeIndexs is used to get the indices of edges adjacent to a given vertex in the PolyMesh;
AMCAX::SubD::MeshTool::VertFaceIndexs is used to get the indices of faces adjacent to a given vertex in the PolyMesh;
AMCAX::SubD::MeshTool::FaceAdjacentFaces is used to get the indices of faces adjacent to a given face in the PolyMesh.
Get the indices of the vertices of a specific edge in the PolyMesh
int edge = 0;
int vfirst, vlast;
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459
Get the indices of all vertices of a specific face in the PolyMesh
Get the indices of all edges of a specific face in the PolyMesh
Get the indices of the faces adjacent to a given edge in the PolyMesh
Get the indices of edges adjacent to a given vertex in the PolyMesh
Get the indices of faces adjacent to a given vertex in the PolyMesh
Get the indices of faces adjacent to a given face in the PolyMesh
Add Face
AMCAX::SubD::MeshInsertFace class provides functionality for adding face. Specifically:
AMCAX::SubD::MeshInsertFace::AddSingleFace is used to add a single face constructed from points to the PolyMesh;
AMCAX::SubD::MeshInsertFace::EmbedSingleFace is used to add a single face constructed from certain PolyMesh vertices;
AMCAX::SubD::MeshInsertFace::AddFaceByEdge is used to add a single face constructed from two edges.
Add a single face constructed from points to the PolyMesh
std::vector< AMCAX::Point3 > p = { p1,p2,p3 };
static AMCAX_API MPolyFace * AddSingleFace(PolyMesh *mesh, std::vector< Point3 > &points)
add a single face constructed from points to PolyMesh
Add a single face constructed from certain PolyMesh vertices to the PolyMesh
The vertices must be boundary vertices, meaning that they are surrounded by boundary edges (edges whose associated faces are less than 2) or have no edges.
int face = 0;
std::vector< int > vlist{ 0,1,2 };
static AMCAX_API MPolyFace * EmbedSingleFace(PolyMesh *mesh, std::vector< int > &vlist)
add a single face constructed from some PolyMesh vert
Add a single face constructed from two edges to the PolyMesh
These two edges must be boundary edges.
int face = 0;
static AMCAX_API MPolyFace * AddFaceByEdge(PolyMesh *mesh, int edge1, int edge2)
add a single face constructed from two edges
Split
AMCAX::SubD::MeshSplit class provides split functionality.
To be down.
Deletion
AMCAX::SubD::MeshReduce class provides deletion functionality. AMCAX::SubD::MeshReduce::DeleteFaces is used to delete faces from the PolyMesh (it allows you to delete any number of faces while leaving holes);AMCAX::SubD::MeshReduce::DeleteIsolatedVertices is used to delete all isolated vertices in the PolyMesh.
Delete Face
std::vector<int> face_id = { 1,3, 4 };
static AMCAX_API void DeleteFaces(PolyMesh *mesh, const std::vector< int > &flist)
Delete given faces in PolyMesh.
Separation and Weld
AMCAX::SubD::MeshSeparate class provides separation functionality, while the AMCAX::SubD::MeshWeld class provides weld functionality.
std::vector< int >edge = { 1,2,3 };
std::cout << r << std::endl;
static AMCAX_API bool SeparateEdges(PolyMesh *mesh, std::vector< int > &edges)
Separate edges into each other, the result edges will remain on top of each other until they are move...
static AMCAX_API void MeshWeldEdges(PolyMesh *mesh, std::vector< int > &elist, double tolerance=0.01)
find all edges in a PolyMesh by input edges with tolerance and Weld them to inner edges
Topological Modeling Function
Topological modeling function include transformation, extrusion, thicken, hole fill, etc.
Transformation
AMCAX::SubD::MeshTransform class provides transformation functionality. Transformation include:
AMCAX::SubD::MeshTransform::TransformMeshEdges Applies transformations to a list of edges in a PolyMesh;
AMCAX::SubD::MeshTransform::TransformMeshFaces;
AMCAX::SubD::MeshTransform::TransformMeshVertices Applies transformations to a list of vertices in a PolyMesh.
Apply Transformation to a List of Edges in PolyMesh
double h = 2.;
std::vector< int > index_e = { 0,1,2 };
constexpr const CoordType & Coord() const noexcept
Get the intrinsic coordinate of the direction.
Definition DirectionT.hpp:213
constexpr const DirectionT< Scalar, DIM > & Direction() const noexcept
Get the main direction (z direction) in 3D.
Definition FrameT.hpp:441
TransformationT< double, 3 > Transformation3
3D transformation
Definition TransformationT.hpp:1102
VectorT< double, 3 > Vector3
3D vector
Definition VectorT.hpp:707
Apply Transformation to a List of Faces in PolyMesh
double h = 2.;
std::vector< int > index_f = { 50,70,90,100 };
Apply Transformation to a List of Vertices in PolyMesh
double h = 2.;
std::vector< int > index_v = { 5,7,9,11 };
Extrusion
AMCAX::SubD::MeshExtrude class provides extrusion functionality. Among which, AMCAX::SubD::MeshExtrude::ExtrudeEdge is used to extrude edges, and AMCAX::SubD::MeshExtrude::ExtrudeFace is used to extrude faces.
To be down.
Thicken
AMCAX::SubD::MeshOffset class provides thicken functionality.
double h = 2;
static AMCAX_API bool ThickenMesh(PolyMesh *mesh, double dist, bool isConnect=true)
Thicken a mesh to give a approximately shell or thickness.
Hole Fill
AMCAX::SubD::MeshFillHole class provides hole filling functionality. Among which, AMCAX::SubD::MeshFillHole::FillAllHole fills all holes in a PolyMesh, and AMCAX::SubD::MeshFillHole::FillSingleHole fills a specific hole in a PolyMesh (by inputting the edge ID of any edge of the hole).
Fill All Holes in PolyMesh
std::vector<int> face_id = { 1,3, 4 };
int face = 0;
std::cout << r << std::endl;
static AMCAX_API bool FillSingleHole(PolyMesh *mesh, int edge)
fill hole whit input edge by use a singel polygon face
Fill a Specific Hole in PolyMesh
std::vector<int> face_id = { 1,3, 4 };
std::cout << r2 << std::endl;
static AMCAX_API bool FillAllHole(PolyMesh *mesh)
fill all holes in PolyMesh by use a singel polygon face
Mesh Subdivision
Mesh subdivision includes two types: Catmull-Clark subdivision and Loop subdivision. Catmull-Clark subdivision supports any mesh, while Loop subdivision only supports triangular meshes (which can be obtained through triangulation using AMCAX::SubD::MeshTool::MeshTriangles).
Catmull-Clark Subdivision
double r = 1;
double h = 1;
static AMCAX_API void CatmullClark(PolyMesh *mesh, size_t subTime)
Catmull-Clark Subdivision for input mesh.
Additionally, to improve the subdivision efficiency, the kernel also provides AMCAX::SubD::MeshSubdivideRenderCC (for full quadrilateral meshes). The result is the same as Catmull-Clark subdivision, with the same number of vertices, but the sequence is different, so it cannot be compared. Additionally, full quadrilateral meshes can be obtained after one subdivision using AMCAX::MeshSubdivideHE::CatmullClark(mesh, 1).
double r = 1;
double h = 1;
std::cout << r1 << std::endl;
Class of PolyMesh API for quadrilateral mesh Catmull-Clark subdivision.
Definition MeshSubdivideRender.hpp:17
AMCAX_API bool DoCatmullClark(PolyMesh *mesh, size_t subtime)
Do Catmull-Clark subdivision.
Loop Subdivision
double r = 1;
double h = 1;
static AMCAX_API void Loop(PolyMesh *mesh, size_t subTime)
Loop subdivision for input mesh, only for triangular mesh.
Additionally, to improve the subdivision efficiency, the kernel also provides AMCAX::SubD::MeshSubdivideRenderLoop (for full triangular meshes). The result is the same as Loop subdivision, with the same number of vertices, but the sequence is different, so it cannot be compared.
Import and Export of OBJ and OFF File
Import
std::string fileNameOBJ5 = "MeshSubdivideRenderLoop.obj";
static AMCAX_API bool LoadMesh(const std::string &filename, PolyMesh *&mesh)
load a PolyMesh from a file
Export
std::string fileNameOBJ = "sampleResult.obj";
std::string fileNameOFF = "sampleResult.off";
static AMCAX_API bool WriteMesh(const std::string &filename, PolyMesh *mesh)
write a PolyMesh to a file