mirror of https://github.com/CGAL/cgal
Use "integer type" and not "std::size_t" for 3MF I/O
This commit is contained in:
parent
47955af9b4
commit
2bdb63b1ae
|
|
@ -35,18 +35,18 @@ namespace CGAL {
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgBGLIoFuncs3MF
|
* \ingroup PkgBGLIoFuncs3MF
|
||||||
*
|
*
|
||||||
* \brief writes the triangle meshes contained in `gs` into the 3mf file `filename`.
|
* \brief writes the triangle meshes contained in `gs` into the file `filename`, using the \ref IOStream3MF.
|
||||||
*
|
*
|
||||||
* \tparam GraphRange a model of the concepts `RandomAccessContainer`
|
* \tparam GraphRange a model of the concepts `RandomAccessContainer`
|
||||||
* and `BackInsertionSequence` whose `value_type` is
|
* and `BackInsertionSequence` whose `value_type` is
|
||||||
* a model of the concepts `FaceGraph` and `HalfedgeListGraph`
|
* a model of the concepts `FaceGraph` and `HalfedgeListGraph`
|
||||||
* that has only triangle faces.
|
* that has only triangle faces.
|
||||||
*
|
*
|
||||||
* \param filename the name of the 3mf file to write.
|
* \param filename the name of the 3mf file to write
|
||||||
* \param gs a container of triangle meshes to write. An internal property map for `CGAL::vertex_point_t`
|
* \param gs a container of triangle meshes to write. An internal property map for `CGAL::vertex_point_t`
|
||||||
* must be available for each mesh.
|
* must be available for each mesh.
|
||||||
* \param names a range of `std::string` associating a name to each mesh to be written out, which
|
* \param names a range of `std::string` associating a name to each mesh to be written out, which
|
||||||
* will appear in the output.
|
* will appear in the output
|
||||||
*
|
*
|
||||||
* \return `true` if the writing is successful, `false` otherwise.
|
* \return `true` if the writing is successful, `false` otherwise.
|
||||||
*
|
*
|
||||||
|
|
@ -70,7 +70,8 @@ bool write_3MF(const std::string& filename,
|
||||||
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
typedef typename boost::graph_traits<FaceGraph>::vertex_descriptor vertex_descriptor;
|
||||||
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
typedef typename boost::graph_traits<FaceGraph>::face_descriptor face_descriptor;
|
||||||
|
|
||||||
typedef std::vector<std::size_t> Triangle;
|
// @todo `Triangle` ought to be just array<int, 3>
|
||||||
|
typedef std::vector<int> Triangle;
|
||||||
typedef std::vector<Triangle> TriangleRange;
|
typedef std::vector<Triangle> TriangleRange;
|
||||||
typedef std::vector<Point> PointRange;
|
typedef std::vector<Point> PointRange;
|
||||||
|
|
||||||
|
|
@ -85,9 +86,11 @@ bool write_3MF(const std::string& filename,
|
||||||
triangles.reserve(num_faces(g));
|
triangles.reserve(num_faces(g));
|
||||||
|
|
||||||
VPM vpm = get(boost::vertex_point, g);
|
VPM vpm = get(boost::vertex_point, g);
|
||||||
std::unordered_map<typename boost::graph_traits<FaceGraph>::vertex_descriptor, std::size_t> vertex_id_map;
|
|
||||||
|
|
||||||
std::size_t i = 0;
|
// @todo dynamic pmap
|
||||||
|
std::unordered_map<typename boost::graph_traits<FaceGraph>::vertex_descriptor, int> vertex_id_map;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
for(const vertex_descriptor v : vertices(g))
|
for(const vertex_descriptor v : vertices(g))
|
||||||
{
|
{
|
||||||
points.push_back(get(vpm, v));
|
points.push_back(get(vpm, v));
|
||||||
|
|
@ -101,6 +104,7 @@ bool write_3MF(const std::string& filename,
|
||||||
for(vertex_descriptor vert : CGAL::vertices_around_face(halfedge(f, g), g))
|
for(vertex_descriptor vert : CGAL::vertices_around_face(halfedge(f, g), g))
|
||||||
triangle.push_back(vertex_id_map[vert]);
|
triangle.push_back(vertex_id_map[vert]);
|
||||||
|
|
||||||
|
CGAL_assertion(triangle.size() == 3);
|
||||||
triangles.push_back(triangle);
|
triangles.push_back(triangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -380,30 +380,30 @@ bool read_3MF(const std::string& fname,
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgStreamSupportIoFuncs3MF
|
* \ingroup PkgStreamSupportIoFuncs3MF
|
||||||
*
|
*
|
||||||
* \brief extracts ranges of points and triangles from a 3mf file.
|
* \brief reads ranges of points and triangles from an input file, using the \ref IOStream3MF.
|
||||||
*
|
*
|
||||||
* \tparam PointRanges a model of the concepts `RandomAccessContainer` and
|
* \tparam PointRanges a model of the concepts `RandomAccessContainer` and
|
||||||
* `BackInsertionSequence` whose `value_type` is
|
* `BackInsertionSequence` whose `value_type` is
|
||||||
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
||||||
* whose `value_type` is the point type.
|
* whose `value_type` is the point type.
|
||||||
* \tparam TriangleRanges a model of the concept `RandomAccessContainer` whose
|
* \tparam TriangleRanges a model of the concept `RandomAccessContainer` whose
|
||||||
* `value_type` is a model of the concept `RandomAccessContainer`
|
* `value_type` is a model of the concept `RandomAccessContainer`
|
||||||
* whose `value_type` is a model of the concept `RandomAccessContainer` whose
|
* whose `value_type` is a model of the concept `RandomAccessContainer` whose
|
||||||
* `value_type` is std::size_t.
|
* `value_type` is an integer type.
|
||||||
* \tparam ColorRanges a model of the concepts `RandomAccessContainer` and
|
* \tparam ColorRanges a model of the concepts `RandomAccessContainer` and
|
||||||
* `BackInsertionSequence` whose `value_type` is
|
* `BackInsertionSequence` whose `value_type` is
|
||||||
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
||||||
* whose `value_type` is `CGAL::Color`.
|
* whose `value_type` is `CGAL::Color`.
|
||||||
*
|
*
|
||||||
* \param fname the name of the 3mf file to read.
|
* \param fname the name of the 3mf file to read
|
||||||
* \param all_points a `PointRanges` that will contain the points of the meshes in `fname`.
|
* \param all_points a `PointRanges` that will contain the points of the meshes in `fname`.
|
||||||
* Each of these meshes will add a range of its points.
|
* Each of these meshes will add a range of its points.
|
||||||
* \param all_triangles a `TriangleRanges` that will contain the triangles of the meshes in `fname`.
|
* \param all_triangles a `TriangleRanges` that will contain the triangles of the meshes in `fname`.
|
||||||
* Each of these meshes will add a range of its triangles. A `triangle` of
|
* Each of these meshes will add a range of its triangles. A `triangle` of
|
||||||
* `all_triangles[i]` contains the indices of its points in `all_points[i]`.
|
* `all_triangles[i]` contains the indices of its points in `all_points[i]`.
|
||||||
* \param all_colors will contain the color of each triangle for each soup.
|
* \param all_colors will contain the color of each triangle for each soup.
|
||||||
* \param names will contain the name of each mesh in `fname` if any.
|
* \param names will contain the name of each mesh in `fname` if any.
|
||||||
* If the i'th mesh has no name, it will be called "Unknown Mesh" in names.
|
* If the i-th mesh has no name, it will be called "Unknown Mesh" in `names`.
|
||||||
*
|
*
|
||||||
* \returns `true` if reading was successful, `false` otherwise.
|
* \returns `true` if reading was successful, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
@ -430,22 +430,21 @@ int read_3MF(const std::string& fname,
|
||||||
/*!
|
/*!
|
||||||
* \ingroup PkgStreamSupportIoFuncs3MF
|
* \ingroup PkgStreamSupportIoFuncs3MF
|
||||||
*
|
*
|
||||||
* \brief writes the triangle soups contained in `all_points` and
|
* \brief writes the triangle soups contained in `all_points` and `all_triangles` into the file `fname`, using the \ref IOStream3MF.
|
||||||
* `all_triangles` into the 3mf file `fname`.
|
|
||||||
*
|
*
|
||||||
* \tparam PointRanges a model of the concepts `RandomAccessContainer` and
|
* \tparam PointRanges a model of the concepts `RandomAccessContainer` and
|
||||||
* `BackInsertionSequence` whose `value_type` is
|
* `BackInsertionSequence` whose `value_type` is
|
||||||
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
* a model of the concepts `RandomAccessContainer` and `BackInsertionSequence`
|
||||||
* whose `value_type` is the point type.
|
* whose `value_type` is the point type.
|
||||||
* \tparam TriangleRanges a model of the concept `RandomAccessContainer` whose
|
* \tparam TriangleRanges a model of the concept `RandomAccessContainer` whose
|
||||||
* `value_type` is a model of the concept `RandomAccessContainer`
|
* `value_type` is a model of the concept `RandomAccessContainer`
|
||||||
* whose `value_type` is a model of the concept `RandomAccessContainer` whose
|
* whose `value_type` is a model of the concept `RandomAccessContainer` whose
|
||||||
* `value_type` is std::size_t.
|
* `value_type` is an integer type.
|
||||||
*
|
*
|
||||||
* \param fname the name of the 3mf file to write.
|
* \param fname the name of the 3mf file to write
|
||||||
* \param all_points a `PointRanges` that contains the points of the soups to write.
|
* \param all_points a `PointRanges` that contains the points of the soups to write
|
||||||
* \param all_triangles a `TriangleRanges` that contains the triangles of the soups in `fname`.
|
* \param all_triangles a `TriangleRanges` that contains the triangles of the soups in `fname`
|
||||||
* \param names contains the name of each mesh to be output.
|
* \param names a range of std::string` associating a name to each soup, which will appear in the output
|
||||||
*
|
*
|
||||||
* \return `true` if the writing is successful, `false` otherwise.
|
* \return `true` if the writing is successful, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue