mirror of https://github.com/CGAL/cgal
20 02 2004 Radu Ursu
- added operator << for Sphere_3 in VRML_2_ostream
- modified the VRML header in VRML_2_ostream
added A1 material
- added test for << operator for spheres
This commit is contained in:
parent
4c7f81165b
commit
00b5253db0
|
|
@ -1,3 +1,9 @@
|
|||
20 02 2004 Radu Ursu
|
||||
- added operator << for Sphere_3 in VRML_2_ostream
|
||||
- modified the VRML header in VRML_2_ostream
|
||||
added A1 material
|
||||
- added test for << operator for spheres
|
||||
|
||||
18 02 2004 Radu Ursu
|
||||
- added in VRML_2_ostream << operators for
|
||||
- Point_3
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ private:
|
|||
"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"
|
||||
|
|
@ -121,7 +125,7 @@ operator<<(VRML_2_ostream& os,
|
|||
const Tetrahedron_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << " Group {\n"
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" appearance\n"
|
||||
|
|
@ -157,7 +161,7 @@ operator<<(VRML_2_ostream& os,
|
|||
" } #IndexedFaceSet\n"
|
||||
" } #Shape\n"
|
||||
" ] #children\n"
|
||||
" } #Group" << std::endl;
|
||||
" } #Group\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +182,7 @@ operator<<(VRML_2_ostream& os,
|
|||
const Point_3<R > &p)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << " Group {\n"
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" geometry\n"
|
||||
|
|
@ -214,7 +218,7 @@ operator<<(VRML_2_ostream& os,
|
|||
const Triangle_3<R > &t)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << " Group {\n"
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" geometry\n"
|
||||
|
|
@ -256,7 +260,7 @@ operator<<(VRML_2_ostream& os,
|
|||
const Segment_3<R > &s)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
os.os() << " Group {\n"
|
||||
os << " Group {\n"
|
||||
" children [\n"
|
||||
" Shape {\n"
|
||||
" geometry\n"
|
||||
|
|
@ -281,4 +285,42 @@ operator<<(VRML_2_ostream& os,
|
|||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_IO_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
|
||||
#ifdef CGAL_SPHERE_3_H
|
||||
#ifndef CGAL_IO_VRML_2_SPHERE_3
|
||||
#define CGAL_IO_VRML_2_SPHERE_3
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class R >
|
||||
VRML_2_ostream&
|
||||
operator<<(VRML_2_ostream& os,
|
||||
const Sphere_3<R > &s)
|
||||
{
|
||||
const char *Indent = " ";
|
||||
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 << sqrt(CGAL::to_double(s.squared_radius())) <<" }\n";
|
||||
os << " } #children Shape\n"
|
||||
" } # Transform\n"
|
||||
" ] #children\n"
|
||||
" } #Group\n";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_IO_VRML_2_SEGMENT_3
|
||||
#endif // CGAL_SEGMENT_3_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// examples/Inventor/VRML2.C
|
||||
// ----------------------------------------
|
||||
// file: test/Inventor/VRML2.C
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/IO/VRML_2_ostream.h>
|
||||
|
|
@ -10,14 +9,16 @@ typedef CGAL::Point_3<Kernel> Point;
|
|||
typedef CGAL::Segment_3<Kernel> Segment;
|
||||
typedef CGAL::Triangle_3<Kernel> Triangle;
|
||||
typedef CGAL::Tetrahedron_3<Kernel> Tetrahedron;
|
||||
typedef CGAL::Sphere_3<Kernel> Sphere;
|
||||
|
||||
int main() {
|
||||
Point p1(10, 15, 0), p2(0, 0, 0),
|
||||
Point p1(10, 15, 0), p2(0, 0, 0),
|
||||
p3(-10, 0, -15), p4(15, 15, 15);
|
||||
Segment s1(p1, p2);
|
||||
Triangle t1(p1, p2, p3);
|
||||
Tetrahedron tet1(p1, p2, p3, p4);
|
||||
Sphere s(p1, p2);
|
||||
CGAL::VRML_2_ostream out( std::cout);
|
||||
out << s1 << t1 << p1 << tet1;
|
||||
out << s1 << t1 << p1 << tet1 << s;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue