Image Component Library (ICL)
GridSceneObject.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLGeom/src/ICLGeom/GridSceneObject.h **
10 ** Module : ICLGeom **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #ifndef ICL_HAVE_OPENGL
34 #if WIN32
35 #pragma WARNING("this header must not be included if ICL_HAVE_OPENGL is not defined")
36 #else
37 #warning "this header must not be included if ICL_HAVE_OPENGL is not defined"
38 #endif
39 #else
40 
41 #include <ICLUtils/CompatMacros.h>
42 #include <ICLGeom/SceneObject.h>
43 
44 
45 namespace icl{
46  namespace geom{
47 
49 
53  int nXCells;
54  int nYCells;
55 
57  void init(int nXCells, int nYCells, const std::vector<Vec> &allGridPoints, bool lines, bool quads) ;
58 
59  public:
61 
63  GridSceneObject(int nXCells, int nYCells, const std::vector<Vec> &allGridPoints,
64  bool lines=true, bool quads=true) ;
65 
67 
68  GridSceneObject(int nXCells, int nYCells, const Vec &origin, const Vec &dx, const Vec &dy,
69  bool lines=true, bool quads=true);
70 
72  inline int getIdx(int x, int y) const { return x+nXCells*y; }
73 
75  Vec &getNode(int x, int y){ return m_vertices[getIdx(x,y)]; }
76 
78  const Vec &getNode(int x, int y) const { return m_vertices[getIdx(x,y)]; }
79 
81  Vec &getNode(const utils::Point &p) { return getNode(p.x,p.y); }
82 
84  const Vec &getNode(const utils::Point &p) const { return getNode(p.x,p.y); }
85 
87  inline utils::Size getSize() const { return utils::Size(nXCells,nYCells); }
88 
90  inline int getWidth() const { return nXCells; }
91 
93  inline int getHeight() const { return nYCells; }
94  };
95 
96 
97  } // namespace geom
98 }
99 
100 #endif
undocument this line if you encounter any issues!
Definition: Any.h:37
int getIdx(int x, int y) const
returns the node index of given node x/y position
Definition: GridSceneObject.h:72
#define ICLGeom_API
Definition: CompatMacros.h:179
utils::Size getSize() const
returns grid dimension (nXCells * nYCells)
Definition: GridSceneObject.h:87
int nXCells
grid width
Definition: GridSceneObject.h:53
int nYCells
grid height
Definition: GridSceneObject.h:54
Vec & getNode(int x, int y)
returns node at given x/y grid position
Definition: GridSceneObject.h:75
Size class of the ICL.
Definition: Size.h:61
const Vec & getNode(const utils::Point &p) const
returns node at given grid position (const)
Definition: GridSceneObject.h:84
int getHeight() const
returns grid height
Definition: GridSceneObject.h:93
const Vec & getNode(int x, int y) const
returns node at given x/y grid position (const)
Definition: GridSceneObject.h:78
Point class of the ICL used e.g. for the Images ROI offset.
Definition: Point.h:58
Vec & getNode(const utils::Point &p)
returns node at given grid position
Definition: GridSceneObject.h:81
int getWidth() const
returns grid width
Definition: GridSceneObject.h:90
The SceneObject class defines visible objects in scenes or scene graph nodes.
Definition: SceneObject.h:140
SceneObject specialization for grid like objects.
Definition: GridSceneObject.h:52