std::string inputfilename = "./data/32770_sf.obj";
io_options.vertex_has_point = true;
reader.
read(inputfilename, io_options);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Points input_points = std::move(reader.
m_points);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Triangles input_triangles = std::move(reader.
m_triangles);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Points output_points = input_points;
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Triangles output_triangles = input_triangles;
std::string outputfilename =
"incrementalRemeshing" + std::to_string(params.
iterNum) +
".obj";
writer.
m_points = std::move(output_points);
writer.
write(outputfilename, io_options, 15);
Options about pre-described properties in mesh IO.
定义 IOOptions.hpp:19
Read triangle soup from an OBJ file.
定义 OBJReader.hpp:38
Points m_points
point position
定义 OBJReader.hpp:125
Triangles m_triangles
triangle faces
定义 OBJReader.hpp:130
AMCAXMeshing_API bool read(const std::string &filename, IOOptions &opt)
Read triangle soup from the file. results will be stored in member variables of reader,...
Write triangle soup to an OBJ file.
定义 OBJWriter.hpp:38
Triangles m_triangles
triangle faces
定义 OBJWriter.hpp:131
AMCAXMeshing_API bool write(const std::string &filename, IOOptions &opt, std::streamsize precision)
Write triangle soup to file with given options and precison.
Points m_points
point position
定义 OBJWriter.hpp:126
定义 TriMesh_IncrementalRemeshing.hpp:24
AMCAXMeshing_API void setReferenceMesh(const iPoints &points, const iTriangles &triangles)
add a triangle mesh (triangle soup) as one input.
AMCAXMeshing_API void setVariableMesh(iPoints &points, iTriangles &triangles)
Set the triangle mesh (triangle soup) as output destination.
AMCAXMeshing_API void remesh(Params params)
Adaptive/Isotropic remeshing controled by the control parameters
constexpr double pi
数学常数 Pi,圆的周长与直径之比
定义 Constants.hpp:42
the parameters that control the remeshing
定义 TriMesh_IncrementalRemeshing.hpp:40
bool featurePreserved
Whether keep the feature or not, not yet implemented
定义 TriMesh_IncrementalRemeshing.hpp:57
double tolAngle
Dihedral angle greater than tolAngle (in radians) will be recognized as a feature edge,...
定义 TriMesh_IncrementalRemeshing.hpp:62
size_t iterNum
The iterations number
定义 TriMesh_IncrementalRemeshing.hpp:66
bool isAdaptive
If true, adaptive remeshing; else, isotropic remeshing
定义 TriMesh_IncrementalRemeshing.hpp:53
double Max_error
Max error between reference mesh and variable mesh
定义 TriMesh_IncrementalRemeshing.hpp:44
double targetEdgeLength
Target edge length expressed as a percentage of the mean length of all edges
定义 TriMesh_IncrementalRemeshing.hpp:49
对 3D 曲面网格进行参数化,得到低扭曲、低自相交的平面参数化网格,为纹理贴图等应用提供支持。需要注意的是输入网格需要保证有切割的边界,并且无非流行结构(网格必须是 2 维流形网格),另外 stl 文件会在一定的误差范围内对点进行合并,所以需要在调用算法前对输入网格进行确认。
io_options.vertex_has_point = true;
std::string in_filename = "./data/cow.obj";
std::string out_cut_filename = "bunny_cut.obj";
std::string out_para_filename = "bunny_parameterization.obj";
obj_reader.
read(in_filename, io_options);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Points i_points = std::move(obj_reader.
m_points);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Triangles i_triangles = std::move(obj_reader.
m_triangles);
i_points, i_triangles, true);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Points cut_points;
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Triangles cut_triangles;
mesh_cut.cut(cut_points, cut_triangles);
obj_writer.
write(out_cut_filename, io_options, 10);
AMCAX::Meshing::Mesh::TriSoupTraits_Coord::Points para_points;
cut_points, cut_triangles, para_points, true);
para.parameterization();
obj_writer.
m_points = std::move(para_points);
obj_writer.
write(out_para_filename, io_options, 10);
AMCAXMeshing_API void clear()
Clear data stored in writer
定义 MeshParameterization.hpp:23