mirror of https://github.com/CGAL/cgal
WIP
This commit is contained in:
parent
a46d62b83e
commit
49f68654d6
|
|
@ -1,11 +1,15 @@
|
|||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/boost/graph/generators.h>
|
||||
|
||||
#include <CGAL/boost/graph/IO/OFF.h>
|
||||
#include <CGAL/boost/graph/IO/VTK.h>
|
||||
#include <CGAL/boost/graph/IO/WRL.h>
|
||||
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef CGAL::Surface_mesh<Point_3> SM;
|
||||
|
|
@ -45,5 +49,10 @@ int main()
|
|||
assert(num_vertices(sm_in) == 3 && num_faces(sm_in) == 1);
|
||||
sm_in.clear();
|
||||
|
||||
//wrl
|
||||
os.open("tmp.wrl");
|
||||
ok = CGAL::write_wrl(os, sm_out, CGAL::parameters::all_default());
|
||||
assert(ok);
|
||||
os.close();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,3 +28,18 @@ endif()
|
|||
|
||||
create_single_source_cgal_program("point_set_test.cpp")
|
||||
create_single_source_cgal_program("point_set_test_join.cpp")
|
||||
create_single_source_cgal_program("test_deprecated_io_ps.cpp")
|
||||
|
||||
#Use LAS
|
||||
#disable if MSVC 2017
|
||||
if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1910))
|
||||
find_package(LASLIB)
|
||||
include(CGAL_LASLIB_support)
|
||||
if (TARGET CGAL::LASLIB_support)
|
||||
target_link_libraries(test_deprecated_io_ps PUBLIC CGAL::LASLIB_support)
|
||||
else()
|
||||
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "NOTICE : the LAS reader does not work with Visual Studio 2017.")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <CGAL/Point_set_3.h>
|
||||
#include <CGAL/Point_set_3/IO/LAS.h>
|
||||
#include <CGAL/Point_set_3/IO/OFF.h>
|
||||
#include <CGAL/Point_set_3/IO/PLY.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::Point_set_3<Point_3, Vector_3> ps, ps2;
|
||||
std::ifstream is("data/oni.pwn");
|
||||
std::ofstream os;
|
||||
|
||||
if(!CGAL::read_xyz_point_set(is, ps))
|
||||
{
|
||||
std::cerr<<"Error while reading input."<<std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
is.close();
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
//LAS
|
||||
os.open("tmp.las", std::ios::binary);
|
||||
bool ok = CGAL::write_las_point_set(os, ps);
|
||||
os.close();
|
||||
assert (ok);
|
||||
|
||||
is.open("tmp.las", std::ios::binary);
|
||||
ok = CGAL::read_las_point_set(is, ps2);
|
||||
is.close();
|
||||
assert(ok);
|
||||
ps2.clear();
|
||||
#endif
|
||||
|
||||
//OFF
|
||||
os.open("tmp.off", std::ios::binary);
|
||||
ok = CGAL::write_off_point_set(os, ps);
|
||||
os.close();
|
||||
assert (ok);
|
||||
|
||||
is.open("tmp.off", std::ios::binary);
|
||||
ok = CGAL::read_off_point_set(is, ps2);
|
||||
is.close();
|
||||
assert(ok);
|
||||
ps2.clear();
|
||||
|
||||
//PLY
|
||||
os.open("tmp.ply", std::ios::binary);
|
||||
ok = CGAL::write_ply_point_set(os, ps);
|
||||
os.close();
|
||||
assert (ok);
|
||||
|
||||
is.open("tmp.ply", std::ios::binary);
|
||||
ok = CGAL::read_ply_point_set(is, ps2);
|
||||
is.close();
|
||||
assert(ok);
|
||||
ps2.clear();
|
||||
|
||||
//XYZ
|
||||
os.open("tmp.xyz", std::ios::binary);
|
||||
ok = CGAL::write_xyz_point_set(os, ps);
|
||||
os.close();
|
||||
assert (ok);
|
||||
|
||||
is.open("tmp.xyz", std::ios::binary);
|
||||
ok = CGAL::read_xyz_point_set(is, ps2);
|
||||
is.close();
|
||||
assert(ok);
|
||||
ps2.clear();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ include(CGAL_TBB_support)
|
|||
# Executables that do *not* require Eigen
|
||||
create_single_source_cgal_program( "read_test.cpp" )
|
||||
create_single_source_cgal_program( "test_read_write_point_set.cpp" )
|
||||
create_single_source_cgal_program( "test_deprecated_io_point_set.cpp" )
|
||||
create_single_source_cgal_program( "read_test_with_different_pmaps.cpp" )
|
||||
create_single_source_cgal_program( "analysis_test.cpp" )
|
||||
create_single_source_cgal_program( "remove_outliers_test.cpp" )
|
||||
|
|
@ -43,6 +44,7 @@ if(NOT MSVC_VERSION OR (MSVC_VERSION GREATER_EQUAL 1919 AND MSVC_VERSION LESS 1
|
|||
include(CGAL_LASLIB_support)
|
||||
if (TARGET CGAL::LASLIB_support)
|
||||
target_link_libraries(test_read_write_point_set PUBLIC ${CGAL_libs} CGAL::LASLIB_support)
|
||||
target_link_libraries(test_deprecated_io_point_set PUBLIC ${CGAL_libs} CGAL::LASLIB_support)
|
||||
else()
|
||||
message(STATUS "NOTICE : the LAS reader test requires LASlib and will not be compiled.")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
//#include <CGAL/internal/disable_deprecation_warnings_and_errors.h>
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
||||
#include <CGAL/Point_set_3.h>
|
||||
#include <CGAL/IO/read_points.h>
|
||||
#include <CGAL/IO/write_points.h>
|
||||
|
||||
// Just to try and create ambiguities
|
||||
#include <CGAL/boost/graph/io.h>
|
||||
#include <CGAL/IO/io.h>
|
||||
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
typedef Kernel::Vector_3 Vector_3;
|
||||
typedef std::array<unsigned short, 4> Color;
|
||||
typedef std::pair<Point_3, Color> PointWithColor;
|
||||
typedef CGAL::Nth_of_tuple_property_map<1, PointWithColor> Color_map;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
std::vector<PointWithColor> points(3);
|
||||
points[0] = std::make_pair(Point_3(1,0,0), Color(255,0,0,255));
|
||||
points[1] = std::make_pair(Point_3(0,1,0), Color(0,255,0,255));
|
||||
points[2] = std::make_pair(Point_3(0,0,1), Color(0,0,255,255));
|
||||
|
||||
|
||||
std::ofstream os;
|
||||
std::ifstream is;
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
os.open("tmp.las", std::ios::binary);
|
||||
bool ok = CGAL::write_las_points_with_properties(os, points, std::make_tuple(
|
||||
),
|
||||
);
|
||||
is.open("data/read_test/pig_points.las", std::ios::binary);
|
||||
|
||||
|
||||
assert(ok);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ namespace CGAL {
|
|||
|
||||
class File_writer_VRML_2
|
||||
{
|
||||
|
||||
VRML_2_ostream m_os;
|
||||
std::size_t m_facets;
|
||||
|
||||
|
|
@ -36,7 +37,7 @@ public:
|
|||
|
||||
std::ostream& out() const { return m_os.os(); }
|
||||
|
||||
void write_header(VRML_2_ostream& o,
|
||||
void write_header(std::ostream& o,
|
||||
std::size_t vertices,
|
||||
std::size_t halfedges,
|
||||
std::size_t facets,
|
||||
|
|
@ -44,7 +45,7 @@ public:
|
|||
const bool /*normals*/ = false,
|
||||
const bool /*textures*/ = false)
|
||||
{
|
||||
m_os = o;
|
||||
m_os = VRML_2_ostream(o);
|
||||
m_facets = facets;
|
||||
|
||||
out() << " #-- Begin of Polygon Mesh\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue