Developer Documentation
CoordFrameNode.hh
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 
43 
44 
45 
46 
47 //=============================================================================
48 //
49 // CLASS CoordFrameNode
50 //
51 //=============================================================================
52 
53 
54 #ifndef ACG_COORDFRAMENODE_HH
55 #define ACG_COORDFRAMENODE_HH
56 
57 
58 //== INCLUDES =================================================================
59 
60 
61 #include "MaterialNode.hh"
62 #include <vector>
63 
64 
65 //== NAMESPACES ===============================================================
66 
67 
68 namespace ACG {
69 namespace SceneGraph {
70 
71 
72 //== CLASS DEFINITION =========================================================
73 
74 
75 
82 class ACGDLLEXPORT CoordFrameNode : public MaterialNode
83 {
84 public:
85 
87  CoordFrameNode(BaseNode* _parent=0,
88  const std::string& _name="<CoordFrameNode>" );
89 
92 
93 
95  ACG_CLASSNAME(CoordFrameNode);
97  DrawModes::DrawMode availableDrawModes() const override;
99  void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax) override;
101  void draw(GLState& _state, const DrawModes::DrawMode& _drawMode) override;
102 
103 
105  void update_bounding_box();
107  void set_bounding_box(const Vec3f& _bb_min, const Vec3f& _bb_max);
109  const Vec3d& bb_min() const { return bb_min_; }
111  const Vec3d& bb_max() const { return bb_max_; }
112 
113 
115  const std::vector<float>& x_planes() const { return x_planes_; }
117  const std::vector<float>& y_planes() const { return y_planes_; }
119  const std::vector<float>& z_planes() const { return z_planes_; }
120 
121 
123  void set_x_planes(const std::vector<float>& _planes) { x_planes_ = _planes; }
125  void set_y_planes(const std::vector<float>& _planes) { y_planes_ = _planes; }
127  void set_z_planes(const std::vector<float>& _planes) { z_planes_ = _planes; }
128 
129 
131  void add_x_plane(float _x) { x_planes_.push_back(_x); }
133  void add_y_plane(float _y) { y_planes_.push_back(_y); }
135  void add_z_plane(float _z) { z_planes_.push_back(_z); }
136 
137 
139  void del_x_plane(float _x) {
140  x_planes_.erase(std::find(x_planes_.begin(), x_planes_.end(), _x));
141  }
143  void del_y_plane(float _y) {
144  y_planes_.erase(std::find(y_planes_.begin(), y_planes_.end(), _y));
145  }
147  void del_z_plane(float _z) {
148  z_planes_.erase(std::find(z_planes_.begin(), z_planes_.end(), _z));
149  }
150 
151 
152 
153 
154 
155 private:
156 
158  CoordFrameNode(const CoordFrameNode& _rhs);
160  CoordFrameNode& operator=(const CoordFrameNode& _rhs);
161 
162 
163  // extend of bounding box
164  Vec3d bb_min_, bb_max_;
165 
166  // planes in x-, y-, z-direction
167  std::vector<float> x_planes_, y_planes_, z_planes_;
168 };
169 
170 
171 //=============================================================================
172 } // namespace SceneGraph
173 } // namespace ACG
174 //=============================================================================
175 #endif // ACG_COORDFRAMENODE_HH defined
176 //=============================================================================
177 
const Vec3d & bb_min() const
get bounding box
void set_x_planes(const std::vector< float > &_planes)
set x-plane container
void add_z_plane(float _z)
add (z == _z)-plane
const std::vector< float > & y_planes() const
get y-plane container
Namespace providing different geometric functions concerning angles.
void add_x_plane(float _x)
add (x == _x)-plane
const std::vector< float > & z_planes() const
get z-plane container
void del_y_plane(float _y)
del (y == _y)-plane
void set_z_planes(const std::vector< float > &_planes)
set z-plane container
void add_y_plane(float _y)
add (y == _y)-plane
void set_y_planes(const std::vector< float > &_planes)
set y-plane container
void del_x_plane(float _x)
del (x == _x)-plane
const std::vector< float > & x_planes() const
get x-plane container
const Vec3d & bb_max() const
get bounding box
void del_z_plane(float _z)
del (z == _z)-plane