mirror of https://github.com/CGAL/cgal
Move LGPL stuff to Stream_support, and Polyhedron_IO GPL stuff to Polyhedron/include/CGAL/IO. Deprecate headers that need it.
As a consequence, Inventor and Polyhedron_IO are entirely deprecated.
This commit is contained in:
parent
914c37b72f
commit
8f793736c7
|
|
@ -24,81 +24,12 @@
|
|||
|
||||
#ifndef CGAL_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
#define CGAL_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/VRML_2_ostream.h>
|
||||
|
||||
#ifdef CGAL_ALPHA_SHAPE_3_H
|
||||
namespace CGAL {
|
||||
|
||||
template <class Dt >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
Alpha_shape_3<Dt> &as)
|
||||
{
|
||||
// Finite vertices coordinates.
|
||||
Alpha_shape_3<Dt>::Alpha_shape_vertices_iterator Vlist_it,
|
||||
Vlist_begin = as.alpha_shape_vertices_begin(),
|
||||
Vlist_end = as.alpha_shape_vertices_end();
|
||||
|
||||
std::map<Alpha_shape_3<Dt>::Vertex_handle, int> V;
|
||||
int number_of_vertex = 0;
|
||||
for( Vlist_it = Vlist_begin; Vlist_it != Vlist_end; Vlist_it++) {
|
||||
V[*Vlist_it] = number_of_vertex++;
|
||||
}
|
||||
|
||||
typename Alpha_shape_3<Dt>::Alpha_shape_facets_iterator Flist_it,
|
||||
Flist_begin = as.alpha_shape_facets_begin(),
|
||||
Flist_end = as.alpha_shape_facets_end();
|
||||
|
||||
std::map<Alpha_shape_3<Dt>::Facet, int> F;
|
||||
int number_of_facets = 0;
|
||||
for( Flist_it = Flist_begin; Flist_it != Flist_end; Flist_it++) {
|
||||
F[*Flist_it] = number_of_facets++;
|
||||
}
|
||||
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedFaceSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n"
|
||||
<< Indent << " ";
|
||||
for( Vlist_it = Vlist_begin; Vlist_it != Vlist_end; Vlist_it++) {
|
||||
os << CGAL::to_double((*Vlist_it)->point().x()) << " ";
|
||||
os << CGAL::to_double((*Vlist_it)->point().y()) << " ";
|
||||
os << CGAL::to_double((*Vlist_it)->point().z()) << ",\n" << Indent << " ";
|
||||
}
|
||||
os << "\n ]\n"
|
||||
" } # coord\n"
|
||||
" solid FALSE\n"
|
||||
<< Indent << "coordIndex [\n";
|
||||
// Finite facets indices.
|
||||
for( Flist_it = Flist_begin; Flist_it != Flist_end; Flist_it++){
|
||||
os << Indent << " ";
|
||||
for (int i=0; i<4; i++)
|
||||
if (i != (*Flist_it).second){
|
||||
os << V[(*Flist_it).first->vertex(i)];
|
||||
os << ", ";
|
||||
}
|
||||
if (Flist_it != Flist_end)
|
||||
os << "-1,\n";
|
||||
else
|
||||
os << "-1 \n";
|
||||
}
|
||||
os << Indent << "]\n";
|
||||
" } #IndexedFaceSet\n"
|
||||
" } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_ALPHA_SHAPE_3_H
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/IO/Alpha_shape_3_VRML_2_ostream.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/IO/VRML/Alpha_shape_3_VRML_2_ostream.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
#include <CGAL/IO/VRML/Alpha_shape_3_VRML_2_ostream.h>
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif CGAL_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
|
|
|
|||
|
|
@ -28,108 +28,12 @@
|
|||
#ifndef CGAL_IO_INVENTOR_OSTREAM_H
|
||||
#define CGAL_IO_INVENTOR_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
// OpenInventor and VRML 1.0 are quite similar formats, so
|
||||
// output operators could be shared if they use the following
|
||||
// base class, which is common for both output streams.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Inventor_ostream_base {
|
||||
private:
|
||||
std::ostream* m_os;
|
||||
public:
|
||||
Inventor_ostream_base() : m_os(0) {}
|
||||
Inventor_ostream_base(std::ostream& o) : m_os(&o) {}
|
||||
~Inventor_ostream_base() { close(); }
|
||||
void open(std::ostream& o) { m_os = &o; }
|
||||
void close() {
|
||||
if ( m_os)
|
||||
os() << std::endl;
|
||||
m_os = 0;
|
||||
}
|
||||
explicit operator bool ()
|
||||
{
|
||||
return m_os && !m_os->fail();
|
||||
}
|
||||
|
||||
std::ostream& os() {
|
||||
// The behaviour if m_os == 0 could be changed to return
|
||||
// cerr or a file handle to /dev/null. The latter one would
|
||||
// mimick the behaviour that one can still use a stream with
|
||||
// an invalid stream, but without producing any output.
|
||||
CGAL_assertion( m_os != 0 );
|
||||
return *m_os;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Inventor_ostream : public Inventor_ostream_base
|
||||
{
|
||||
public:
|
||||
Inventor_ostream() {}
|
||||
Inventor_ostream(std::ostream& o) : Inventor_ostream_base(o) {
|
||||
header();
|
||||
}
|
||||
void open(std::ostream& o) {
|
||||
Inventor_ostream_base::open(o);
|
||||
header();
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#Inventor V2.0 ascii" << std::endl;
|
||||
os() << "# File written with the help of the CGAL Library"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_INVENTOR_OSTREAM_H
|
||||
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_INVENTOR_TETRAHEDRON_3
|
||||
#define CGAL_INVENTOR_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
Inventor_ostream&
|
||||
operator<<(Inventor_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << "\n Separator {";
|
||||
os.os() << "\n Coordinate3 { \n"
|
||||
<< Indent << "point [\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) << " ]"
|
||||
<< "\n } #Coordinate3" ;
|
||||
os.os() << "\n IndexedFaceSet {"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
<< "\n } #IndexedFaceSet"
|
||||
<< "\n } #Separator\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/IO/Inventor_ostream.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/IO/VRML/Inventor_ostream.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
#include <CGAL/IO/VRML/Inventor_ostream.h>
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_INVENTOR_TETRAHEDRON_3
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
|
|
|
|||
|
|
@ -28,82 +28,12 @@
|
|||
#ifndef CGAL_IO_VRML_1_OSTREAM_H
|
||||
#define CGAL_IO_VRML_1_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
// Declare the common base class for OpenInventor and VRML 1.0 format.
|
||||
#include <CGAL/IO/Inventor_ostream.h>
|
||||
|
||||
// OpenInventor and VRML 1.0 are quite similar formats, so
|
||||
// output operators could be shared if they use the common
|
||||
// base class Inventor_ostream_base, which is common for
|
||||
// both output streams.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class VRML_1_ostream : public Inventor_ostream_base {
|
||||
public:
|
||||
VRML_1_ostream() {}
|
||||
VRML_1_ostream(std::ostream& o) : Inventor_ostream_base(o) {
|
||||
header();
|
||||
}
|
||||
void open(std::ostream& o) {
|
||||
Inventor_ostream_base::open(o);
|
||||
header();
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#VRML V1.0 ascii" << std::endl;
|
||||
os() << "# File written with the help of the CGAL Library"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_1_OSTREAM_H
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_IO_VRML_1_TETRAHEDRON_3
|
||||
#define CGAL_IO_VRML_1_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_1_ostream&
|
||||
operator<<(VRML_1_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << "\n Separator {";
|
||||
os.os() << "\n Coordinate3 { \n"
|
||||
<< Indent << "point [\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) << " ]"
|
||||
<< "\n } #Coordinate3" ;
|
||||
os.os() << "\n IndexedFaceSet {"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
<< "\n } #IndexedFaceSet"
|
||||
<< "\n } #Separator\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/IO/VRML_1_ostream.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/IO/VRML/VRML_1_ostream.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
#include <CGAL/IO/VRML/VRML_1_ostream.h>"
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_IO_VRML_1_TETRAHEDRON_3
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
|
|
|
|||
|
|
@ -27,295 +27,12 @@
|
|||
|
||||
#ifndef CGAL_IO_VRML_2_OSTREAM_H
|
||||
#define CGAL_IO_VRML_2_OSTREAM_H
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class VRML_2_ostream {
|
||||
public:
|
||||
VRML_2_ostream() : m_os(0) {}
|
||||
VRML_2_ostream(std::ostream& o) : m_os(&o) { header();}
|
||||
~VRML_2_ostream() { close(); }
|
||||
void open(std::ostream& o) { m_os = &o; header(); }
|
||||
void close() {
|
||||
if ( m_os)
|
||||
footer();
|
||||
m_os = 0;
|
||||
}
|
||||
explicit operator bool () {
|
||||
return m_os && !m_os->fail();
|
||||
}
|
||||
std::ostream& os() {
|
||||
// The behaviour if m_os == 0 could be changed to return
|
||||
// cerr or a file handle to /dev/null. The latter one would
|
||||
// mimick the behaviour that one can still use a stream with
|
||||
// an invalid stream, but without producing any output.
|
||||
CGAL_assertion( m_os != 0 );
|
||||
return *m_os;
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#VRML V2.0 utf8\n"
|
||||
"# File written with the help of the CGAL Library\n"
|
||||
"#-- Begin of file header\n"
|
||||
"Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance DEF A1 Appearance {\n"
|
||||
" material Material {\n"
|
||||
" diffuseColor .6 .5 .9\n"
|
||||
" }\n }\n"
|
||||
" appearance\n"
|
||||
" Appearance {\n"
|
||||
" material DEF Material Material {}\n"
|
||||
" }\n"
|
||||
" geometry nullptr\n"
|
||||
" }\n"
|
||||
" #-- End of file header" << std::endl;
|
||||
}
|
||||
void footer() {
|
||||
os() << " #-- Begin of file footer\n"
|
||||
" ]\n"
|
||||
"}\n"
|
||||
"#-- End of file footer" << std::endl;
|
||||
}
|
||||
std::ostream* m_os;
|
||||
};
|
||||
|
||||
inline
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const char* s)
|
||||
{
|
||||
os.os() << s;
|
||||
return os;
|
||||
}
|
||||
|
||||
inline
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const double& d)
|
||||
{
|
||||
os.os() << d;
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_OSTREAM_H
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
#define CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance\n"
|
||||
" Appearance {\n"
|
||||
" material USE Material\n"
|
||||
" } #Appearance\n"
|
||||
" geometry\n"
|
||||
" IndexedFaceSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) <<
|
||||
"\n ]\n"
|
||||
" }\n"
|
||||
" solid FALSE\n"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
" } #IndexedFaceSet\n"
|
||||
" } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
|
||||
#ifdef CGAL_POINT_3_H
|
||||
#ifndef CGAL_IO_VRML_2_POINT_3
|
||||
#define CGAL_IO_VRML_2_POINT_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Point_3<R > &p)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" PointSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ ";
|
||||
os << CGAL::to_double(p.x()) << " " << CGAL::to_double(p.y())
|
||||
<< " " << CGAL::to_double(p.z()) << " ]\n";
|
||||
os << Indent << "}\n";
|
||||
os << Indent << "} # PointSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_POINT_3
|
||||
#endif // CGAL_POINT_3_H
|
||||
|
||||
|
||||
|
||||
#ifdef CGAL_TRIANGLE_3_H
|
||||
#ifndef CGAL_IO_VRML_2_TRIANGLE_3
|
||||
#define CGAL_IO_VRML_2_TRIANGLE_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Triangle_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedLineSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n";
|
||||
os << Indent ;
|
||||
os << CGAL::to_double(t[0].x()) << " " << CGAL::to_double(t[0].y())
|
||||
<< " " << CGAL::to_double(t[0].z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(t[1].x()) << " " << CGAL::to_double(t[1].y())
|
||||
<< " " << CGAL::to_double(t[1].z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(t[2].x()) << " " << CGAL::to_double(t[2].y())
|
||||
<< " " << CGAL::to_double(t[2].z()) << " ]\n";
|
||||
os << Indent << "}\n" << Indent << "coordIndex [ 0 1, 1 2, 2 0 -1 ]\n";
|
||||
os << Indent << "} # IndexedLineSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_TRIANGLE_3
|
||||
#endif // CGAL_TRIANGLE_3_H
|
||||
|
||||
|
||||
#ifdef CGAL_SEGMENT_3_H
|
||||
#ifndef CGAL_IO_VRML_2_SEGMENT_3
|
||||
#define CGAL_IO_VRML_2_SEGMENT_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Segment_3<R > &s)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedLineSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n";
|
||||
os << Indent << CGAL::to_double(s.source().x());
|
||||
os << " " << CGAL::to_double(s.source().y())
|
||||
<< " " << CGAL::to_double(s.source().z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(s.target().x())
|
||||
<< " " << CGAL::to_double(s.target().y())
|
||||
<< " " << CGAL::to_double(s.target().z()) << " ]\n";
|
||||
os << Indent << "}\n" << Indent << "coordIndex [ 0 1 -1 ]\n";
|
||||
os << Indent << "} # IndexedLineSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/IO/VRML_2_ostream.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/IO/VRML/VRML_2_ostream.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
#include <CGAL/IO/VRML/VRML_2_ostream.h>
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_IO_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
|
||||
#ifdef CGAL_SPHERE_3_H
|
||||
#ifndef CGAL_IO_VRML_2_SPHERE_3
|
||||
#define CGAL_IO_VRML_2_SPHERE_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Sphere_3<R > &s)
|
||||
{
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Transform {\n"
|
||||
" translation ";
|
||||
os << CGAL::to_double(s.center().x()) << " "
|
||||
<< CGAL::to_double(s.center().y()) << " "
|
||||
<< CGAL::to_double(s.center().z()) << "\n";
|
||||
os << " children Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" Sphere { "
|
||||
"radius ";
|
||||
os << std::sqrt(CGAL::to_double(s.squared_radius())) <<" }\n";
|
||||
os << " } #children Shape\n"
|
||||
" } # Transform\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SPHERE_3_H
|
||||
|
|
|
|||
|
|
@ -13,13 +13,15 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
// Author(s) : Andreas Fabri
|
||||
|
||||
#ifndef CGAL_IO_POLYHEDRON_STL_BUILDER_H
|
||||
#define CGAL_IO_POLYHEDRON_STL_BUILDER_H
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
#include <CGAL/Modifier_base.h>
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/IO/STL_reader.h>
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_POLYHEDRON_SCAN_OFF_H
|
||||
#define CGAL_IO_POLYHEDRON_SCAN_OFF_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/OFF/File_header_OFF.h>
|
||||
#include <CGAL/IO/OFF/File_scanner_OFF.h>
|
||||
#include <CGAL/Modifier_base.h>
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <iostream>
|
||||
#include <cstddef>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class HDS>
|
||||
class Polyhedron_scan_OFF : public Modifier_base<HDS> {
|
||||
protected:
|
||||
std::istream& m_in;
|
||||
File_header_OFF m_file_header;
|
||||
public:
|
||||
|
||||
typedef HDS Halfedge_data_structure;
|
||||
|
||||
// DEFINITION
|
||||
//
|
||||
// Polyhedron_scan_OFF<Traits> is a polyhedral surface builder.
|
||||
// It scans a polyhedron given in OFF from a stream and appends it
|
||||
// incrementally using the incremental builder.
|
||||
|
||||
Polyhedron_scan_OFF( std::istream& in, bool verbose = false)
|
||||
: m_in(in), m_file_header( verbose) {}
|
||||
|
||||
// Activation
|
||||
void operator()( HDS& hds);
|
||||
|
||||
const File_header_OFF& header() const { return m_file_header; }
|
||||
};
|
||||
|
||||
template < class HDS >
|
||||
void
|
||||
Polyhedron_scan_OFF<HDS>:: operator()( HDS& target) {
|
||||
File_scanner_OFF scanner( m_in, m_file_header.verbose());
|
||||
if ( ! m_in) {
|
||||
if ( scanner.verbose()) {
|
||||
std::cerr << " " << std::endl;
|
||||
std::cerr << "Polyhedron_scan_OFF<HDS>::" << std::endl;
|
||||
std::cerr << "operator(): input error: file format is not in "
|
||||
"OFF." << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
m_file_header = scanner; // Remember file header after return.
|
||||
|
||||
Polyhedron_incremental_builder_3<HDS> B( target, scanner.verbose());
|
||||
B.begin_surface( scanner.size_of_vertices(),
|
||||
scanner.size_of_facets(),
|
||||
scanner.size_of_halfedges());
|
||||
|
||||
typedef typename HDS::Traits Traits;
|
||||
typedef typename Traits::Point_3 Point;
|
||||
|
||||
// read in all vertices
|
||||
std::size_t i;
|
||||
for ( i = 0; i < scanner.size_of_vertices(); i++) {
|
||||
Point p;
|
||||
file_scan_vertex( scanner, p);
|
||||
B.add_vertex( p);
|
||||
if(scanner.has_colors())
|
||||
{
|
||||
Color c;
|
||||
file_scan_color(scanner, c);
|
||||
}
|
||||
else
|
||||
scanner.skip_to_next_vertex( i);
|
||||
}
|
||||
if ( ! m_in || B.error()) {
|
||||
B.rollback();
|
||||
m_in.clear( std::ios::badbit);
|
||||
return;
|
||||
}
|
||||
|
||||
// read in all facets
|
||||
for ( i = 0; i < scanner.size_of_facets(); i++) {
|
||||
B.begin_facet();
|
||||
std::size_t no;
|
||||
scanner.scan_facet( no, i);
|
||||
if( ! m_in || B.error() || no < 3) {
|
||||
if ( scanner.verbose()) {
|
||||
std::cerr << " " << std::endl;
|
||||
std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
|
||||
std::cerr << "operator()(): input error: facet " << i
|
||||
<< " has less than 3 vertices." << std::endl;
|
||||
}
|
||||
B.rollback();
|
||||
m_in.clear( std::ios::badbit);
|
||||
return;
|
||||
}
|
||||
for ( std::size_t j = 0; j < no; j++) {
|
||||
std::size_t index;
|
||||
scanner.scan_facet_vertex_index( index, i);
|
||||
B.add_vertex_to_facet( index);
|
||||
}
|
||||
//TO DO : Insert read color
|
||||
B.end_facet();
|
||||
scanner.skip_to_next_facet( i);
|
||||
}
|
||||
if ( ! m_in || B.error()) {
|
||||
B.rollback();
|
||||
m_in.clear( std::ios::badbit);
|
||||
return;
|
||||
}
|
||||
if ( B.check_unconnected_vertices()) {
|
||||
if ( ! B.remove_unconnected_vertices()) {
|
||||
if ( scanner.verbose()) {
|
||||
std::cerr << " " << std::endl;
|
||||
std::cerr << "Polyhedron_scan_OFF<Traits>::" << std::endl;
|
||||
std::cerr << "operator()(): input error: cannot "
|
||||
"successfully remove isolated vertices."
|
||||
<< std::endl;
|
||||
}
|
||||
B.rollback();
|
||||
m_in.clear( std::ios::badbit);
|
||||
return;
|
||||
}
|
||||
}
|
||||
B.end_surface();
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_IO_POLYHEDRON_SCAN_OFF_H //
|
||||
// EOF //
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_PRINT_OFF_H
|
||||
#define CGAL_IO_PRINT_OFF_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/OFF/File_writer_OFF.h>
|
||||
#include <CGAL/IO/generic_print_polyhedron.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Polyhedron, class Vpm>
|
||||
void print_polyhedron_with_header_OFF( std::ostream& out,
|
||||
const Polyhedron& P,
|
||||
const File_header_OFF& header,
|
||||
const Vpm& vpm) {
|
||||
File_writer_OFF writer( header);
|
||||
writer.header().set_polyhedral_surface( true);
|
||||
writer.header().set_halfedges( P.size_of_halfedges());
|
||||
generic_print_polyhedron( out, P, writer, vpm);
|
||||
}
|
||||
|
||||
template <class Polyhedron>
|
||||
void print_polyhedron_with_header_OFF( std::ostream& out,
|
||||
const Polyhedron& P,
|
||||
const File_header_OFF& header)
|
||||
{
|
||||
print_polyhedron_with_header_OFF(out, P, header, get(CGAL::vertex_point, P));
|
||||
}
|
||||
|
||||
template <class Polyhedron>
|
||||
void print_polyhedron_OFF( std::ostream& out,
|
||||
const Polyhedron& P,
|
||||
bool verbose = false) {
|
||||
File_header_OFF header( verbose);
|
||||
header.set_binary( is_binary( out));
|
||||
header.set_no_comments( ! is_pretty( out));
|
||||
print_polyhedron_with_header_OFF( out, P, header);
|
||||
}
|
||||
|
||||
|
||||
// Deprecated global functions, replaced with functions above
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void
|
||||
print_OFF( std::ostream& out,
|
||||
const Polyhedron_3<Traits,Items,HDS,Alloc>& P,
|
||||
bool verbose = false) {
|
||||
File_writer_OFF writer( verbose);
|
||||
writer.header().set_binary( is_binary( out));
|
||||
writer.header().set_no_comments( ! is_pretty( out));
|
||||
writer.header().set_polyhedral_surface( true);
|
||||
writer.header().set_halfedges( P.size_of_halfedges());
|
||||
generic_print_polyhedron( out, P, writer);
|
||||
}
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void
|
||||
print_OFF( std::ostream& out,
|
||||
const Polyhedron_3<Traits,Items,HDS,Alloc>& P,
|
||||
const File_header_OFF& header) {
|
||||
File_writer_OFF writer( header);
|
||||
writer.header().set_polyhedral_surface( true);
|
||||
writer.header().set_halfedges( P.size_of_halfedges());
|
||||
generic_print_polyhedron( out, P, writer);
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_PRINT_OFF_H //
|
||||
// EOF //
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_OBJ_PRINT_WAVEFRONT_H
|
||||
#define CGAL_IO_OBJ_PRINT_WAVEFRONT_H 1
|
||||
#ifndef CGAL_IO_PRINT_WAVEFRONT_H
|
||||
#define CGAL_IO_PRINT_WAVEFRONT_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
|
@ -52,5 +52,5 @@ print_wavefront( std::ostream& out,
|
|||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_OBJ_PRINT_WAVEFRONT_H //
|
||||
#endif // CGAL_IO_PRINT_WAVEFRONT_H //
|
||||
// EOF //
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_SCAN_OFF_H
|
||||
#define CGAL_IO_SCAN_OFF_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/IO/Polyhedron_scan_OFF.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void scan_OFF( std::istream& in,
|
||||
Polyhedron_3<Traits,Items,HDS,Alloc>& P,
|
||||
File_header_OFF& header) {
|
||||
// reads a polyhedron from `in' and appends it to P.
|
||||
// Returns also the File_header_OFF structure of the object.
|
||||
typedef Polyhedron_3<Traits,Items,HDS,Alloc> Polyhedron;
|
||||
typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
|
||||
typedef Polyhedron_scan_OFF<HalfedgeDS> Scanner;
|
||||
Scanner scanner( in, header.verbose());
|
||||
P.delegate(scanner);
|
||||
header = scanner.header();
|
||||
}
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void scan_OFF( std::istream& in, Polyhedron_3<Traits,Items,HDS,Alloc>& P,
|
||||
bool verbose = false) {
|
||||
// reads a polyhedron from `in' and appends it to P.
|
||||
typedef Polyhedron_3<Traits,Items,HDS,Alloc> Polyhedron;
|
||||
typedef typename Polyhedron::HalfedgeDS HalfedgeDS;
|
||||
typedef Polyhedron_scan_OFF<HalfedgeDS> Scanner;
|
||||
Scanner scanner( in, verbose);
|
||||
P.delegate(scanner);
|
||||
}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_SCAN_OFF_H //
|
||||
// EOF //
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_PRINT_WAVEFRONT_H
|
||||
#define CGAL_IO_PRINT_WAVEFRONT_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#define CGAL_DEPRECATED_HEADER "<CGAL/IO/print_wavefront.h>"
|
||||
#define CGAL_REPLACEMENT_HEADER "<CGAL/IO/OBJ/print_wavefront.h>"
|
||||
#include <CGAL/internal/deprecation_warning.h>
|
||||
#include <CGAL/IO/OBJ/print_wavefront.h>
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
|
||||
#endif // CGAL_IO_PRINT_WAVEFRONT_H //
|
||||
// EOF //
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// Copyright (c) 1997
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
//
|
||||
// Author(s) : Andreas Fabri
|
||||
|
||||
#ifndef CGAL_IO_VRML_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
#define CGAL_IO_VRML_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/VRML_2_ostream.h>
|
||||
|
||||
#ifdef CGAL_ALPHA_SHAPE_3_H
|
||||
namespace CGAL {
|
||||
|
||||
template <class Dt >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
Alpha_shape_3<Dt> &as)
|
||||
{
|
||||
// Finite vertices coordinates.
|
||||
Alpha_shape_3<Dt>::Alpha_shape_vertices_iterator Vlist_it,
|
||||
Vlist_begin = as.alpha_shape_vertices_begin(),
|
||||
Vlist_end = as.alpha_shape_vertices_end();
|
||||
|
||||
std::map<Alpha_shape_3<Dt>::Vertex_handle, int> V;
|
||||
int number_of_vertex = 0;
|
||||
for( Vlist_it = Vlist_begin; Vlist_it != Vlist_end; Vlist_it++) {
|
||||
V[*Vlist_it] = number_of_vertex++;
|
||||
}
|
||||
|
||||
typename Alpha_shape_3<Dt>::Alpha_shape_facets_iterator Flist_it,
|
||||
Flist_begin = as.alpha_shape_facets_begin(),
|
||||
Flist_end = as.alpha_shape_facets_end();
|
||||
|
||||
std::map<Alpha_shape_3<Dt>::Facet, int> F;
|
||||
int number_of_facets = 0;
|
||||
for( Flist_it = Flist_begin; Flist_it != Flist_end; Flist_it++) {
|
||||
F[*Flist_it] = number_of_facets++;
|
||||
}
|
||||
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedFaceSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n"
|
||||
<< Indent << " ";
|
||||
for( Vlist_it = Vlist_begin; Vlist_it != Vlist_end; Vlist_it++) {
|
||||
os << CGAL::to_double((*Vlist_it)->point().x()) << " ";
|
||||
os << CGAL::to_double((*Vlist_it)->point().y()) << " ";
|
||||
os << CGAL::to_double((*Vlist_it)->point().z()) << ",\n" << Indent << " ";
|
||||
}
|
||||
os << "\n ]\n"
|
||||
" } # coord\n"
|
||||
" solid FALSE\n"
|
||||
<< Indent << "coordIndex [\n";
|
||||
// Finite facets indices.
|
||||
for( Flist_it = Flist_begin; Flist_it != Flist_end; Flist_it++){
|
||||
os << Indent << " ";
|
||||
for (int i=0; i<4; i++)
|
||||
if (i != (*Flist_it).second){
|
||||
os << V[(*Flist_it).first->vertex(i)];
|
||||
os << ", ";
|
||||
}
|
||||
if (Flist_it != Flist_end)
|
||||
os << "-1,\n";
|
||||
else
|
||||
os << "-1 \n";
|
||||
}
|
||||
os << Indent << "]\n";
|
||||
" } #IndexedFaceSet\n"
|
||||
" } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_ALPHA_SHAPE_3_H
|
||||
|
||||
#endif CGAL_IO_VRML_ALPHA_SHAPE_3_VRML_2_OSTREAM_H
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
// Copyright (c) 1997
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
//
|
||||
// Author(s) : Andreas Fabri
|
||||
// Lutz Kettner <kettner@inf.ethz.ch>
|
||||
// Herve Bronnimann <Herve.Bronnimann@sophia.inria.fr>
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_IO_VRML_INVENTOR_OSTREAM_H
|
||||
#define CGAL_IO_VRML_INVENTOR_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
|
||||
// OpenInventor and VRML 1.0 are quite similar formats, so
|
||||
// output operators could be shared if they use the following
|
||||
// base class, which is common for both output streams.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Inventor_ostream_base {
|
||||
private:
|
||||
std::ostream* m_os;
|
||||
public:
|
||||
Inventor_ostream_base() : m_os(0) {}
|
||||
Inventor_ostream_base(std::ostream& o) : m_os(&o) {}
|
||||
~Inventor_ostream_base() { close(); }
|
||||
void open(std::ostream& o) { m_os = &o; }
|
||||
void close() {
|
||||
if ( m_os)
|
||||
os() << std::endl;
|
||||
m_os = 0;
|
||||
}
|
||||
explicit operator bool ()
|
||||
{
|
||||
return m_os && !m_os->fail();
|
||||
}
|
||||
|
||||
std::ostream& os() {
|
||||
// The behaviour if m_os == 0 could be changed to return
|
||||
// cerr or a file handle to /dev/null. The latter one would
|
||||
// mimick the behaviour that one can still use a stream with
|
||||
// an invalid stream, but without producing any output.
|
||||
CGAL_assertion( m_os != 0 );
|
||||
return *m_os;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Inventor_ostream : public Inventor_ostream_base
|
||||
{
|
||||
public:
|
||||
Inventor_ostream() {}
|
||||
Inventor_ostream(std::ostream& o) : Inventor_ostream_base(o) {
|
||||
header();
|
||||
}
|
||||
void open(std::ostream& o) {
|
||||
Inventor_ostream_base::open(o);
|
||||
header();
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#Inventor V2.0 ascii" << std::endl;
|
||||
os() << "# File written with the help of the CGAL Library"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_INVENTOR_OSTREAM_H
|
||||
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_INVENTOR_TETRAHEDRON_3
|
||||
#define CGAL_INVENTOR_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
Inventor_ostream&
|
||||
operator<<(Inventor_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << "\n Separator {";
|
||||
os.os() << "\n Coordinate3 { \n"
|
||||
<< Indent << "point [\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) << " ]"
|
||||
<< "\n } #Coordinate3" ;
|
||||
os.os() << "\n IndexedFaceSet {"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
<< "\n } #IndexedFaceSet"
|
||||
<< "\n } #Separator\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
#endif // CGAL_VRML_INVENTOR_TETRAHEDRON_3
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_POLYHEDRON_VRML_1_OSTREAM_H
|
||||
#define CGAL_IO_POLYHEDRON_VRML_1_OSTREAM_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/IO/VRML_1_ostream.h>
|
||||
#include <CGAL/IO/Polyhedron_inventor_ostream.h>
|
||||
|
||||
#endif // CGAL_IO_POLYHEDRON_VRML_1_OSTREAM_H //
|
||||
// EOF //
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_POLYHEDRON_VRML_2_OSTREAM_H
|
||||
#define CGAL_IO_POLYHEDRON_VRML_2_OSTREAM_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/VRML_2_ostream.h>
|
||||
#include <CGAL/IO/File_writer_VRML_2.h>
|
||||
#include <CGAL/IO/generic_print_polyhedron.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
VRML_2_ostream&
|
||||
operator<<( VRML_2_ostream& out,
|
||||
const Polyhedron_3<Traits,Items,HDS,Alloc>& P) {
|
||||
File_writer_VRML_2 writer;
|
||||
generic_print_polyhedron( out.os(), P, writer);
|
||||
return out;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_POLYHEDRON_VRML_2_OSTREAM_H //
|
||||
// EOF //
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
// Copyright (c) 1997
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
//
|
||||
// Author(s) : Andreas Fabri
|
||||
// Lutz Kettner <kettner@inf.ethz.ch>
|
||||
// Herve Bronnimann <Herve.Bronnimann@sophia.inria.fr>
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_IO_VRML_VRML_1_OSTREAM_H
|
||||
#define CGAL_IO_VRML_VRML_1_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
|
||||
// Declare the common base class for OpenInventor and VRML 1.0 format.
|
||||
#include <CGAL/IO/Inventor_ostream.h>
|
||||
|
||||
// OpenInventor and VRML 1.0 are quite similar formats, so
|
||||
// output operators could be shared if they use the common
|
||||
// base class Inventor_ostream_base, which is common for
|
||||
// both output streams.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class VRML_1_ostream : public Inventor_ostream_base {
|
||||
public:
|
||||
VRML_1_ostream() {}
|
||||
VRML_1_ostream(std::ostream& o) : Inventor_ostream_base(o) {
|
||||
header();
|
||||
}
|
||||
void open(std::ostream& o) {
|
||||
Inventor_ostream_base::open(o);
|
||||
header();
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#VRML V1.0 ascii" << std::endl;
|
||||
os() << "# File written with the help of the CGAL Library"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_1_OSTREAM_H
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_IO_VRML_1_TETRAHEDRON_3
|
||||
#define CGAL_IO_VRML_1_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_1_ostream&
|
||||
operator<<(VRML_1_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << "\n Separator {";
|
||||
os.os() << "\n Coordinate3 { \n"
|
||||
<< Indent << "point [\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) << " ]"
|
||||
<< "\n } #Coordinate3" ;
|
||||
os.os() << "\n IndexedFaceSet {"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
<< "\n } #IndexedFaceSet"
|
||||
<< "\n } #Separator\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
#endif // CGAL_IO_VRML_VRML_1_TETRAHEDRON_3
|
||||
|
|
@ -0,0 +1,321 @@
|
|||
// Copyright (c) 1997
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0+
|
||||
//
|
||||
// Author(s) : Andreas Fabri
|
||||
// Lutz Kettner <kettner@inf.ethz.ch>
|
||||
// Herve Bronnimann
|
||||
// Mariette Yvinec <Mariette.Yvinec@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_IO_VRML_VRML_2_OSTREAM_H
|
||||
#define CGAL_IO_VRML_VRML_2_OSTREAM_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class VRML_2_ostream {
|
||||
public:
|
||||
VRML_2_ostream() : m_os(0) {}
|
||||
VRML_2_ostream(std::ostream& o) : m_os(&o) { header();}
|
||||
~VRML_2_ostream() { close(); }
|
||||
void open(std::ostream& o) { m_os = &o; header(); }
|
||||
void close() {
|
||||
if ( m_os)
|
||||
footer();
|
||||
m_os = 0;
|
||||
}
|
||||
explicit operator bool () {
|
||||
return m_os && !m_os->fail();
|
||||
}
|
||||
std::ostream& os() {
|
||||
// The behaviour if m_os == 0 could be changed to return
|
||||
// cerr or a file handle to /dev/null. The latter one would
|
||||
// mimick the behaviour that one can still use a stream with
|
||||
// an invalid stream, but without producing any output.
|
||||
CGAL_assertion( m_os != 0 );
|
||||
return *m_os;
|
||||
}
|
||||
private:
|
||||
void header() {
|
||||
os() << "#VRML V2.0 utf8\n"
|
||||
"# File written with the help of the CGAL Library\n"
|
||||
"#-- Begin of file header\n"
|
||||
"Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance DEF A1 Appearance {\n"
|
||||
" material Material {\n"
|
||||
" diffuseColor .6 .5 .9\n"
|
||||
" }\n }\n"
|
||||
" appearance\n"
|
||||
" Appearance {\n"
|
||||
" material DEF Material Material {}\n"
|
||||
" }\n"
|
||||
" geometry nullptr\n"
|
||||
" }\n"
|
||||
" #-- End of file header" << std::endl;
|
||||
}
|
||||
void footer() {
|
||||
os() << " #-- Begin of file footer\n"
|
||||
" ]\n"
|
||||
"}\n"
|
||||
"#-- End of file footer" << std::endl;
|
||||
}
|
||||
std::ostream* m_os;
|
||||
};
|
||||
|
||||
inline
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const char* s)
|
||||
{
|
||||
os.os() << s;
|
||||
return os;
|
||||
}
|
||||
|
||||
inline
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const double& d)
|
||||
{
|
||||
os.os() << d;
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_OSTREAM_H
|
||||
|
||||
#ifdef CGAL_TETRAHEDRON_3_H
|
||||
#ifndef CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
#define CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance\n"
|
||||
" Appearance {\n"
|
||||
" material USE Material\n"
|
||||
" } #Appearance\n"
|
||||
" geometry\n"
|
||||
" IndexedFaceSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[0].x()) << " "
|
||||
<< CGAL::to_double(t[0].y()) << " "
|
||||
<< CGAL::to_double(t[0].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[1].x()) << " "
|
||||
<< CGAL::to_double(t[1].y()) << " "
|
||||
<< CGAL::to_double(t[1].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[2].x()) << " "
|
||||
<< CGAL::to_double(t[2].y()) << " "
|
||||
<< CGAL::to_double(t[2].z()) << " ,\n"
|
||||
<< Indent << " "
|
||||
<< CGAL::to_double(t[3].x()) << " "
|
||||
<< CGAL::to_double(t[3].y()) << " "
|
||||
<< CGAL::to_double(t[3].z()) <<
|
||||
"\n ]\n"
|
||||
" }\n"
|
||||
" solid FALSE\n"
|
||||
<< Indent << "coordIndex [ 0,1,2,-1, 1,3,2,-1,\n"
|
||||
<< Indent << " 0,2,3,-1, 0,3,1,-1 ]\n"
|
||||
" } #IndexedFaceSet\n"
|
||||
" } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_TETRAHEDRON_3
|
||||
#endif // CGAL_TETRAHEDRON_3_H
|
||||
|
||||
#ifdef CGAL_POINT_3_H
|
||||
#ifndef CGAL_IO_VRML_2_POINT_3
|
||||
#define CGAL_IO_VRML_2_POINT_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Point_3<R > &p)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" PointSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ ";
|
||||
os << CGAL::to_double(p.x()) << " " << CGAL::to_double(p.y())
|
||||
<< " " << CGAL::to_double(p.z()) << " ]\n";
|
||||
os << Indent << "}\n";
|
||||
os << Indent << "} # PointSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_POINT_3
|
||||
#endif // CGAL_POINT_3_H
|
||||
|
||||
|
||||
|
||||
#ifdef CGAL_TRIANGLE_3_H
|
||||
#ifndef CGAL_IO_VRML_2_TRIANGLE_3
|
||||
#define CGAL_IO_VRML_2_TRIANGLE_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Triangle_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedLineSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n";
|
||||
os << Indent ;
|
||||
os << CGAL::to_double(t[0].x()) << " " << CGAL::to_double(t[0].y())
|
||||
<< " " << CGAL::to_double(t[0].z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(t[1].x()) << " " << CGAL::to_double(t[1].y())
|
||||
<< " " << CGAL::to_double(t[1].z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(t[2].x()) << " " << CGAL::to_double(t[2].y())
|
||||
<< " " << CGAL::to_double(t[2].z()) << " ]\n";
|
||||
os << Indent << "}\n" << Indent << "coordIndex [ 0 1, 1 2, 2 0 -1 ]\n";
|
||||
os << Indent << "} # IndexedLineSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_TRIANGLE_3
|
||||
#endif // CGAL_TRIANGLE_3_H
|
||||
|
||||
|
||||
#ifdef CGAL_SEGMENT_3_H
|
||||
#ifndef CGAL_IO_VRML_2_SEGMENT_3
|
||||
#define CGAL_IO_VRML_2_SEGMENT_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Segment_3<R > &s)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" IndexedLineSet {\n"
|
||||
" coord Coordinate {\n"
|
||||
" point [ \n";
|
||||
os << Indent << CGAL::to_double(s.source().x());
|
||||
os << " " << CGAL::to_double(s.source().y())
|
||||
<< " " << CGAL::to_double(s.source().z()) << ",\n";
|
||||
os << Indent;
|
||||
os << CGAL::to_double(s.target().x())
|
||||
<< " " << CGAL::to_double(s.target().y())
|
||||
<< " " << CGAL::to_double(s.target().z()) << " ]\n";
|
||||
os << Indent << "}\n" << Indent << "coordIndex [ 0 1 -1 ]\n";
|
||||
os << Indent << "} # IndexedLineSet\n";
|
||||
os << " } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
|
||||
#ifdef CGAL_SPHERE_3_H
|
||||
#ifndef CGAL_IO_VRML_2_SPHERE_3
|
||||
#define CGAL_IO_VRML_2_SPHERE_3
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Sphere_3<R > &s)
|
||||
{
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Transform {\n"
|
||||
" translation ";
|
||||
os << CGAL::to_double(s.center().x()) << " "
|
||||
<< CGAL::to_double(s.center().y()) << " "
|
||||
<< CGAL::to_double(s.center().z()) << "\n";
|
||||
os << " children Shape {\n"
|
||||
" appearance USE A1\n"
|
||||
" geometry\n"
|
||||
" Sphere { "
|
||||
"radius ";
|
||||
os << std::sqrt(CGAL::to_double(s.squared_radius())) <<" }\n";
|
||||
os << " } #children Shape\n"
|
||||
" } # Transform\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_IO_VRML_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SPHERE_3_H
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_PRINT_VRML_1_H
|
||||
#define CGAL_IO_PRINT_VRML_1_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/IO/Polyhedron_VRML_1_ostream.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Polyhedron>
|
||||
void print_polyhedron_VRML_1( std::ostream& out, const Polyhedron& P) {
|
||||
VRML_1_ostream os( out);
|
||||
os << P;
|
||||
}
|
||||
|
||||
// Deprecated global functions, replaced with functions above
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void
|
||||
print_VRML_1( std::ostream& out,
|
||||
const Polyhedron_3<Traits,Items,HDS,Alloc>& P) {
|
||||
VRML_1_ostream os( out);
|
||||
os << P;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_PRINT_VRML_1_H //
|
||||
// EOF //
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) 1997 ETH Zurich (Switzerland).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0+
|
||||
//
|
||||
//
|
||||
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
|
||||
|
||||
#ifndef CGAL_IO_PRINT_VRML_2_H
|
||||
#define CGAL_IO_PRINT_VRML_2_H 1
|
||||
|
||||
#include <CGAL/license/Polyhedron.h>
|
||||
|
||||
|
||||
#include <CGAL/IO/Polyhedron_VRML_2_ostream.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Polyhedron>
|
||||
void print_polyhedron_VRML_2( std::ostream& out, const Polyhedron& P) {
|
||||
VRML_2_ostream os( out);
|
||||
os << P;
|
||||
}
|
||||
|
||||
// Deprecated global functions, replaced with functions above
|
||||
|
||||
template < class Traits,
|
||||
class Items,
|
||||
template < class T, class I, class A>
|
||||
class HDS, class Alloc>
|
||||
void
|
||||
print_VRML_2( std::ostream& out,
|
||||
const Polyhedron_3<Traits,Items,HDS,Alloc>& P) {
|
||||
VRML_2_ostream os( out);
|
||||
os << P;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_IO_PRINT_VRML_2_H //
|
||||
// EOF //
|
||||
Loading…
Reference in New Issue