Subversion Repositories spk

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
114 cycrow 1
#ifndef BOB_GEOMETRY_INCLUDED
2
#define BOB_GEOMETRY_INCLUDED
3
 
4
#include "geometry.h"
5
 
6
template <class Ty>
7
class point3d : public geometry::point3d<Ty>
8
{
9
	public:
10
		point3d() 
11
			: geometry::point3d<value_type>()
12
		{ }
13
		point3d(const geometry::point3d<value_type>& pt) 
14
			: geometry::point3d<value_type>(pt)
15
		{ }
16
		point3d(value_type x, value_type y, value_type z) 
17
			: geometry::point3d<value_type>(x, y, z)
18
		{ }
19
 
20
		bool load(ibinaryfilestream& is)
21
		{
22
			is >> x >> y >> z;
23
			return !is.fail();
24
		}
25
 
26
		bool toFile(obinaryfilestream& os) const
27
		{
28
			os << x << y << z;
29
			return !os.fail();
30
		}
31
 
32
		bool toFile(otextfilestream& os) const
33
		{
34
			os << x << y << z;
35
			return !os.fail();
36
		}
37
};
38
 
39
template <class Ty>
40
class point2d : public geometry::point2d<Ty>
41
{
42
	public:
43
		public:
44
		point2d() 
45
			: geometry::point2d<value_type>()
46
		{ }
47
		point2d(const geometry::point2d<value_type>& pt) 
48
			: geometry::point2d<value_type>(pt)
49
		{ }
50
		point2d(value_type x, value_type y)
51
			: geometry::point2d<value_type>(x, y)
52
		{ }
53
 
54
		bool load(ibinaryfilestream& is)
55
		{
56
			is >> x >> y;
57
			return !is.fail();
58
		}
59
 
60
		bool toFile(obinaryfilestream& os) const
61
		{
62
			os << x << y;
63
			return !os.fail();
64
		}
65
 
66
		bool toFile(otextfilestream& os) const
67
		{
68
			os << x << y;
69
			return !os.fail();
70
		}
71
};
72
 
73
/*
74
class vertex : public point3d<int>
75
{
76
	public:
77
		vertex() 
78
			: point3d<value_type>()
79
		{ }
80
		vertex(const point3d<value_type>& pt) 
81
			: point3d<value_type>(pt)
82
		{ }
83
		vertex(int x, int y, int z) 
84
			: point3d<value_type>(x, y, z)
85
		{ }
86
 
87
		bool toFile(otextfilestream& os) const
88
		{
89
			os << x << y << z;
90
			return !os.fail();
91
		}
92
 
93
};
94
 
95
class vector : public point3d<double>
96
{
97
	public:
98
		typedef point3d<value_type> base;
99
 
100
		vector() 
101
			: point3d<value_type>()
102
		{ }
103
		vector(const point3d<value_type>& pt) 
104
			: point3d<value_type>(pt)
105
		{ }
106
		vector(double x, double y, double z) 
107
			: point3d<value_type>(x, y, z)
108
		{ }
109
 
110
		bool toFile(otextfilestream& os) const
111
		{
112
			os << x << y << z;
113
			return !os.fail();
114
		}
115
		bool toFile(obinaryfilestream& os) const { return base::toFile(os); }
116
};
117
*/
118
typedef point3d<int> vertex;
119
typedef point3d<double> vector;
120
typedef vector normal_vector;
121
typedef vertex position3d;
122
 
123
#endif // !defined(BOB_GEOMETRY_INCLUDED)