mt
 All Classes Files Functions Enumerations Groups Pages
point3.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2006 by Adolfo Rodriguez *
3  * adolfo.rodriguez@upc.edu *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
22 
23 // HEADER GUARD
24 #ifndef MT_POINT3_H
25 #define MT_POINT3_H
26 
27 // MT LIBRARY HEADERS
28 #include <mt/exception.h>
29 #include <mt/scalar.h>
30 #include <mt/vector3.h>
31 
32 
34 
35 namespace mt
36 {
37 
38 
40 
43 
50 
51 class Point3 : public Vector3
52 {
53 public:
54 
55 // LIFECYCLE
56 
58  Point3();
59 
61  Point3(const Scalar& x,
62  const Scalar& y,
63  const Scalar& z);
64 
66  explicit Point3(const Scalar* p);
67 
69  Point3(const Vector3& v);
70 
71  // Compiler generated copy constructor is being used
72 
73  // Compiler generated destructor is being used
74 
75 
76 // OPERATORS
77 
80  bool operator==(const Point3& p) const;
81 
82  bool operator!=(const Point3& p) const;
83 };
84 
85 
87 
88 // LIFECYCLE
89 
90 inline Point3::Point3() : Vector3() {}
91 
92 
93 inline Point3::Point3(const Scalar& x,
94  const Scalar& y,
95  const Scalar& z) : Vector3(x, y, z) {}
96 
97 
98 inline Point3::Point3(const Scalar* p) : Vector3(p) {}
99 
100 
101 inline Point3::Point3(const Vector3& v) : Vector3(v) {}
102 
103 // OPERATORS
104 
105 inline bool Point3::operator==(const Point3& p) const
106 {
107  return (distance(p) == 0.0);
108 }
109 
110 
111 inline bool Point3::operator!=(const Point3& p) const
112 {
113  return !(*this == p);
114 }
115 
116 } // mt
117 
118 #endif // MT_POINT3_H