Dopcument NPs in BGL

This commit is contained in:
Maxime Gimeno 2020-04-28 12:09:46 +02:00
parent 83a929f7bb
commit e0b0f0b244
8 changed files with 100 additions and 13 deletions

View File

@ -70,8 +70,17 @@ public:
reads the graph `g` from the stream `in` in the OBJ format. reads the graph `g` from the stream `in` in the OBJ format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\returns `true` if the resulting mesh is valid. \returns `true` if the resulting mesh is valid.
\sa Overloads of this function for specific models of the concept `FaceGraph`.
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
\see \ref IOStreamOBJ \see \ref IOStreamOBJ
@ -94,12 +103,19 @@ bool read_OBJ(std::istream& in,
reads the graph `g` from data in the OFF format. Ignores comment lines which start with a hash, reads the graph `g` from data in the OFF format. Ignores comment lines which start with a hash,
and lines with whitespace. and lines with whitespace.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\returns `true` if the resulting mesh is valid.
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
\attention The graph `g` is not cleared, and the data from the stream are added.
\see \ref IOStreamOBJ \see \ref IOStreamOBJ
*/ */
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
@ -135,8 +151,17 @@ bool read_OBJ(const std::string& fname, FaceGraph& g) { return read_OBJ(fname, g
writes the graph `g` in the OBJ format. writes the graph `g` in the OBJ format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\returns `true` if writing was successful. \returns `true` if writing was successful.
\sa Overloads of this function for specific models of the concept `FaceGraph`.
\see \ref IOStreamOBJ \see \ref IOStreamOBJ
*/ */
template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename FaceGraph, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>
@ -153,7 +178,16 @@ bool write_OBJ(std::ostream& os,
writes the graph `g` in the OFF format into a file named `fname`. writes the graph `g` in the OFF format into a file named `fname`.
\sa Overloads of this function for specific models of the concept `FaceGraph`. \cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalParamBegin{vertex_normal_map} the property map with the normals associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\returns `true` if writing was successful.
\sa Overloads of this function for specific models of the concept `FaceGraph`.
\see \ref IOStreamOBJ \see \ref IOStreamOBJ
*/ */

View File

@ -95,7 +95,7 @@ bool read_OFF_BGL(std::istream& in,
\cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd \cgalParamBegin{vertex_texture_map} the property map with the textures associated to the vertices of `g`.\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd \cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold

View File

@ -98,6 +98,19 @@ bool read_PLY(const std::string& fname, FaceGraph& g) { return read_PLY(fname, g
reads the graph `g` from data in the PLY format. reads the graph `g` from data in the PLY format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map}
the property map with the points associated to the vertices of `g` .
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`
\cgalParamEnd
\cgalParamBegin{vertex_index_map}
is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`.
\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.
@ -115,6 +128,19 @@ bool read_PLY(std::istream& in, FaceGraph& g, const CGAL_BGL_NP_CLASS& np)
reads the graph `g` from a file named `fname`, in the PLY format. reads the graph `g` from a file named `fname`, in the PLY format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map}
the property map with the points associated to the vertices of `g` .
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`
\cgalParamEnd
\cgalParamBegin{vertex_index_map}
is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`.
\cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
\pre The data must represent a 2-manifold \pre The data must represent a 2-manifold
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.
@ -173,6 +199,8 @@ bool read_PLY(const std::string& fname, FaceGraph& g)
\cgalParamBegin{vertex_index_map} \cgalParamBegin{vertex_index_map}
is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`. is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`.
\cgalParamEnd \cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\see \ref IOStreamPLY \see \ref IOStreamPLY
@ -181,8 +209,7 @@ template <class FaceGraph, class NamedParameters>
bool write_PLY(std::ostream& os, bool write_PLY(std::ostream& os,
const FaceGraph& g, const FaceGraph& g,
const std::string& comments, const std::string& comments,
const NamedParameters& np const NamedParameters& np)
)
{ {
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>::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits<FaceGraph>::halfedge_descriptor halfedge_descriptor;
@ -344,6 +371,8 @@ bool write_PLY(std::ostream& os,
\cgalParamBegin{vertex_index_map} \cgalParamBegin{vertex_index_map}
is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`. is a property map containing for each vertex of `g` a unique index between `0` and `num_vertices(g)-1`.
\cgalParamEnd \cgalParamEnd
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
\see \ref IOStreamPLY \see \ref IOStreamPLY

View File

@ -123,6 +123,11 @@ bool read_STL(const std::string& fname, FaceGraph& g) { return read_STL(fname, g
writes the graph `g` in the stream `out` in the STL format. writes the graph `g` in the stream `out` in the STL format.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalNamedParamsEnd
\pre The graph must contain only triangle faces. \pre The graph must contain only triangle faces.
\see \ref IOStreamSTL \see \ref IOStreamSTL
@ -204,6 +209,12 @@ bool write_STL(std::ostream& out,
writes the graph `g` in the STL format into a file named `fname`. writes the graph `g` in the STL format into a file named `fname`.
\cgalNamedParamsBegin
\cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
If this parameter is omitted, an internal property map for
`CGAL::vertex_point_t` should be available in `FaceGraph`\cgalParamEnd
\cgalNamedParamsEnd
\sa Overloads of this function for specific models of the concept `FaceGraph`. \sa Overloads of this function for specific models of the concept `FaceGraph`.
\see \ref IOStreamSTL \see \ref IOStreamSTL

View File

@ -377,7 +377,7 @@ bool test_PLY(bool binary = false)
return true; return true;
} }
//todo tests OBJ + tests with all NPs and without NP for all tests
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -410,6 +410,7 @@ int main(int argc, char** argv)
if(!test_soup_gocad()) if(!test_soup_gocad())
return 1; return 1;
// STL // STL
if(!test_STL<Polyhedron>()) if(!test_STL<Polyhedron>())
return 1; return 1;

View File

@ -193,7 +193,7 @@ template <typename PointRange,
bool write_OBJ(std::ostream& os, bool write_OBJ(std::ostream& os,
const PointRange& points, const PointRange& points,
const PolygonRange& polygons, const PolygonRange& polygons,
const CGAL_BGL_NP_CLASS& np) const CGAL_BGL_NP_CLASS& )
{ {
Generic_writer<std::ostream, File_writer_wavefront> writer(os); Generic_writer<std::ostream, File_writer_wavefront> writer(os);
return writer(points, polygons); return writer(points, polygons);

View File

@ -1,16 +1,16 @@
// Copyright (c) 1997 // Copyright (c) 1997
// Utrecht University (The Netherlands), // Utrecht University (The Netherlands),
// ETH Zurich (Switzerland), // ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France), // INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany), // Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved. // and Tel-Aviv University (Israel). All rights reserved.
// //
// This file is part of CGAL (www.cgal.org); // This file is part of CGAL (www.cgal.org);
// //
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
// //
// //
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de> // Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
@ -150,7 +150,10 @@ public:
out() << ' ' << index; out() << ' ' << index;
} }
void write_face_color(const double, const double, const double) { } void write_face_color(const double r, const double g, const double b)
{
write_vertex_color(r, g, b);
}
void write_facet_end() void write_facet_end()
{ {

View File

@ -236,6 +236,10 @@ bool read_PLY(std::istream& is,
* `PolygonRange` is a model of the concepts `RandomAccessContainer` * `PolygonRange` is a model of the concepts `RandomAccessContainer`
* and `BackInsertionSequence` whose `value type` is `std::size_t`. * and `BackInsertionSequence` whose `value type` is `std::size_t`.
* *
\cgalNamedParamsBegin
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
* \see \ref IOStreamPLY * \see \ref IOStreamPLY
*/ */
template <typename PointRange, typename PolygonRange, typename NamedParameters> template <typename PointRange, typename PolygonRange, typename NamedParameters>
@ -358,7 +362,12 @@ read_PLY(std::istream& is,
* *
* `PolygonRange` is a model of the concepts `RandomAccessContainer` * `PolygonRange` is a model of the concepts `RandomAccessContainer`
* and `BackInsertionSequence` whose `value type` is `std::size_t`. * and `BackInsertionSequence` whose `value type` is `std::size_t`.
*
\cgalNamedParamsBegin
\cgalParamBegin{face_color_map} the property map with the colors associated to the faces of `g`.\cgalParamEnd
\cgalParamBegin{vertex_color_map} the property map with the colors associated to the vertices of `g`.\cgalParamEnd
\cgalNamedParamsEnd
* \see \ref IOStreamPLY * \see \ref IOStreamPLY
*/ */
template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS> template <typename PointRange, typename PolygonRange, typename CGAL_BGL_NP_TEMPLATE_PARAMETERS>