Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
hom_coord.h
1 
2 /***************************************************************************
3  * hom_coord.h - Homogeneous coordinates
4  *
5  * Created: Thu Sep 27 16:07:00 2007
6  * Copyright 2007-2008 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __GEOMETRY_HOM_COORD_H_
25 #define __GEOMETRY_HOM_COORD_H_
26 
27 #include <geometry/printable.h>
28 
29 namespace fawkes {
30 
31 class Vector;
32 class HomTransform;
33 
34 class HomCoord : public Printable
35 {
36  public:
37  HomCoord(const HomCoord& c);
38 
39  virtual ~HomCoord();
40 
41  virtual float x() const;
42  virtual float& x();
43  virtual HomCoord& x(float x);
44 
45  virtual float y() const;
46  virtual float& y();
47  virtual HomCoord& y(float y);
48 
49  virtual float z() const;
50  virtual float& z();
51  virtual HomCoord& z(float z);
52 
53  virtual float w() const;
54  virtual float& w();
55  virtual HomCoord& w(float w);
56 
57  virtual HomCoord& rotate_x(float rad);
58  virtual HomCoord& rotate_y(float rad);
59  virtual HomCoord& rotate_z(float rad);
60 
61  HomCoord& transform(const HomTransform& t);
62 
63  virtual HomCoord operator-(const HomCoord& h) const;
64  virtual HomCoord& operator-=(const HomCoord& h);
65 
66  virtual HomCoord operator+(const HomCoord& h) const;
67  virtual HomCoord& operator+=(const HomCoord& h);
68 
69  virtual float operator*(const HomCoord& h) const;
70 
71  virtual HomCoord operator*(const float s) const;
72  virtual HomCoord& operator*=(const float s);
73 
74  virtual HomCoord& operator=(const HomCoord& h);
75 
76  virtual bool operator==(const HomCoord& h) const;
77  virtual bool operator!=(const HomCoord& h) const;
78 
79  protected:
80  HomCoord(float x = 0.0, float y = 0.0, float z = 0.0, float w = 0.0);
81  HomCoord(const Vector& v);
82 
83  virtual std::ostream& print(std::ostream& stream) const;
84 
86 };
87 
88 } // end namespace fawkes
89 
90 #endif /* __GEOMETRY_HOM_COORD_H_ */
virtual float y() const
RO-getter for y.
Definition: hom_coord.cpp:115
virtual HomCoord & rotate_x(float rad)
Convenience function to rotate the HomCoord around the x-axis.
Definition: hom_coord.cpp:206
virtual HomCoord & operator=(const HomCoord &h)
Assignment operator.
Definition: hom_coord.cpp:303
A simple column vector.
Definition: vector.h:31
virtual bool operator!=(const HomCoord &h) const
Inequality operator.
Definition: hom_coord.cpp:367
virtual bool operator==(const HomCoord &h) const
Comparison operator.
Definition: hom_coord.cpp:357
Vector * m_vector
The internal data container.
Definition: hom_coord.h:85
virtual ~HomCoord()
Destructor.
Definition: hom_coord.cpp:76
virtual HomCoord & rotate_y(float rad)
Convenience function to rotate the HomCoord around the y-axis.
Definition: hom_coord.cpp:220
This class describes a homogeneous transformation.
Definition: hom_transform.h:31
virtual HomCoord operator-(const HomCoord &h) const
Subtraction operator.
Definition: hom_coord.cpp:248
virtual HomCoord & operator-=(const HomCoord &h)
Substraction-assignment operator.
Definition: hom_coord.cpp:262
virtual float z() const
RO-getter for z.
Definition: hom_coord.cpp:145
virtual float w() const
RO-getter for w.
Definition: hom_coord.cpp:175
Base class for homogeneous primitives (vector and point).
Definition: hom_coord.h:34
HomCoord(const HomCoord &c)
Copy constructor.
Definition: hom_coord.cpp:61
virtual HomCoord & operator+=(const HomCoord &h)
Addition-assignment operator.
Definition: hom_coord.cpp:289
HomCoord & transform(const HomTransform &t)
Transform the vector with the given transform.
Definition: hom_coord.cpp:387
virtual float operator*(const HomCoord &h) const
Calculates the dot product of two coords.
Definition: hom_coord.cpp:315
virtual HomCoord & rotate_z(float rad)
Convenience function to rotate the HomCoord around the z-axis.
Definition: hom_coord.cpp:234
virtual std::ostream & print(std::ostream &stream) const
Appends the components of the HomCoord to the ostream.
Definition: hom_coord.cpp:377
virtual HomCoord operator+(const HomCoord &h) const
Addition operator.
Definition: hom_coord.cpp:275
virtual HomCoord & operator*=(const float s)
Multiplication-assignment operator.
Definition: hom_coord.cpp:343
virtual float x() const
RO-getter for x.
Definition: hom_coord.cpp:85
Interface class for printable objects.
Definition: printable.h:37