Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
transformable.cpp
1
2
/***************************************************************************
3
* transformable.h - Transformable interface
4
*
5
* Created: Thu Oct 02 16:53:27 2008
6
* Copyright 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
#include <geometry/transformable.h>
25
26
namespace
fawkes {
27
28
/** @class fawkes::Transformable <geometry/transformable.h>
29
* Interface class for all transformable objects. In order to be
30
* tranformable by multiplying the geometric object with a
31
* fawkes::HomTransform it should be derived from this class (although
32
* it doesn't have to).
33
*
34
* @author Daniel Beck
35
*/
36
37
/** @fn void fawkes::Transformable::register_primitives()
38
* Here, a derived class should register its primitives (HomPoints and
39
* HomVectors) by calling add_primitive for each of those.
40
*/
41
42
/** @fn void fawkes::Transformable::post_transform()
43
* This method is called after the primitives are transformed. Any
44
* additional updates that need to be done should be done here.
45
*/
46
47
/** Constructor. */
48
Transformable::Transformable
()
49
{
50
}
51
52
53
/** Destructor. */
54
Transformable::~Transformable
()
55
{
56
}
57
58
/** Add a primitive to the list of primitives that is transformed.
59
* @param c a primitive (a HomCoord or an object of a derived class)
60
*/
61
void
62
Transformable::add_primitive
(
HomCoord
* c)
63
{
64
m_primitives.push_back(c);
65
}
66
67
/** Clear the list of primitives. */
68
void
69
Transformable::clear_primitives
()
70
{
71
m_primitives.clear();
72
}
73
74
/** Apply the transform to all registered primitives and call the
75
* post_transform() method.
76
* @param t a transform
77
*/
78
void
79
Transformable::transform
(
const
HomTransform
& t)
80
{
81
std::vector<HomCoord*>::const_iterator iter;
82
for
( iter = m_primitives.begin();
83
iter != m_primitives.end();
84
++iter )
85
{
86
HomCoord
* c = *iter;
87
c->
transform
(t);
88
}
89
90
post_transform
();
91
}
92
93
}
// end namespace fawkes
src
libs
geometry
transformable.cpp
Generated by
1.8.1.1