40 #ifdef ICL_SYSTEM_APPLE 41 #include <OpenGL/gl.h> 42 #include <OpenGL/glu.h> 57 ICLGeom_API void octree_object_render_box(
float x0,
float y0,
float z0,
58 float x1,
float y1,
float z1);
60 template<
class Scalar,
int CAPACITY,
int SF,
class Pt,
int ALLOC_CHUNK_SIZE>
61 struct OctreePointRenderer{
62 typedef typename math::Octree<Scalar,CAPACITY,SF,Pt,ALLOC_CHUNK_SIZE>::Node Node;
63 static void render(
const Node *node){
65 for(
const Pt *p = node->points; p < node->next;++p){
66 glVertex3f( (*p)[0],(*p)[1],(*p)[2]);
73 template<
int CAPACITY,
int SF,
int ALLOC_CHUNK_SIZE>
75 struct OctreePointRenderer<float,CAPACITY,SF,math::FixedColVector<float,4>,ALLOC_CHUNK_SIZE>{
76 typedef FixedColVector<float,4> Pt;
77 typedef typename math::Octree<float,CAPACITY,SF,Pt,ALLOC_CHUNK_SIZE>::Node Node;
78 static void render(
const Node *node){
79 glEnableClientState(GL_VERTEX_ARRAY);
80 glVertexPointer(4,GL_FLOAT,0,node->points);
81 glDrawArrays(GL_POINTS, 0, (
int)(node->next - node->points));
82 glDisableClientState(GL_VERTEX_ARRAY);
86 template<
int CAPACITY,
int SF,
int ALLOC_CHUNK_SIZE>
87 struct OctreePointRenderer<
icl32s,CAPACITY,SF,math::FixedColVector<icl32s,4>,ALLOC_CHUNK_SIZE>{
88 typedef FixedColVector<icl32s,4> Pt;
89 typedef typename math::Octree<icl32s,CAPACITY,SF,Pt,ALLOC_CHUNK_SIZE>::Node Node;
90 static void render(
const Node *node){
91 glEnableClientState(GL_VERTEX_ARRAY);
92 glVertexPointer(4,GL_INT,0,node->points);
93 glDrawArrays(GL_POINTS, 0, (
int)(node->next - node->points));
94 glDisableClientState(GL_VERTEX_ARRAY);
128 template<
class Scalar,
int CAPACITY=4,
int SF=32,
class Pt=math::FixedColVector<Scalar,4>,
int ALLOC_CHUNK_SIZE=1024>
150 OctreeObject(
const Scalar &minX,
const Scalar &minY,
const Scalar &minZ,
151 const Scalar &width,
const Scalar &height,
const Scalar &
depth):
170 for(
int i=0;i<xyzh.
getDim();i+=1){
175 for(
int i=0;i<xyz.
getDim();i+=1){
191 template<
class Filter>
197 for(
int i=0;i<xyzh.
getDim();i+=1){
204 for(
int i=0;i<xyz.
getDim();i+=1){
245 return ( (
sqr(v[0]-
pos[0]) +
299 glMatrixMode(GL_MODELVIEW);
302 glScalef(1./SF,1./SF,1./SF);
304 GLboolean lightWasOn =
true;
305 glGetBooleanv(GL_LIGHTING,&lightWasOn);
306 glDisable(GL_LIGHTING);
316 glEnable(GL_LIGHTING);
325 void box(
const typename Parent::AABB &bb)
const {
326 const Pt &c = bb.center, s = bb.halfSize;
327 octree_object_render_box(c[0] - s[0],c[1] - s[1],c[2] - s[2],
328 c[0] + s[0],c[1] + s[1],c[2] + s[2]);
340 OctreePointRenderer<Scalar,CAPACITY,SF,Pt,ALLOC_CHUNK_SIZE>::render(node);
343 for(
int i=0;i<8;++i){
353 for(
int i=0;i<8;++i){
void setBoxColor(const GeomColor &color)
sets the color used for boxes (default is semi-transparent green)
Definition: OctreeObject.h:276
void fill(const PointCloudObjectBase &obj, bool clearBefore=true)
Adds all points from the given point cloud object to the octree.
Definition: OctreeObject.h:165
GeomColor m_pointColor
color used for the points (if rendered)
Definition: OctreeObject.h:135
undocument this line if you encounter any issues!
Definition: Any.h:37
const Vec & getPosition() const
Definition: Camera.h:439
void clear()
removes all contained points and nodes
Definition: Octree.h:471
Base class for point cloud data types.
Definition: PointCloudObjectBase.h:98
void insert(const OtherVectorType &pIn)
inserts a node into the QuadTree
Definition: Octree.h:410
#define ICLGeom_API
Definition: CompatMacros.h:179
OctreeObject(const Scalar &min, const Scalar &len)
create OctreeObject from given cubic axis-aligned bounding box
Definition: OctreeObject.h:158
The OctreeObjects provides a visualizable SceneObject interface for the Octree class.
Definition: OctreeObject.h:129
bool m_renderPoints
flag whether points are rendered as well
Definition: OctreeObject.h:133
void fill(const PointCloudObjectBase &obj, Filter f, bool clearBefore)
Adds all points from the given point cloud object to the octree.
Definition: OctreeObject.h:192
math::Octree< Scalar, CAPACITY, SF, Pt, ALLOC_CHUNK_SIZE > Parent
typedef to the parent class type
Definition: OctreeObject.h:132
void setRenderPoints(bool enabled)
sets whether points are rendered as well
Definition: OctreeObject.h:256
float m_pointSize
Definition: SceneObject.h:829
void setPointColor(const GeomColor &color)
sets the color used for rendering ppoints (if point rendering is activated)
Definition: OctreeObject.h:287
PointFilter(const Vec &p, float radius=10)
Create point filter with given center and radius.
Definition: OctreeObject.h:228
FixedMatrix< T, NEW_WIDTH, NEW_HEIGHT > resize(const T &init=T(0)) const
extends/shrinks matrix dimensions while preserving content on remaining elements (without scaling)
Definition: FixedMatrix.h:811
GeomColor getBoxColor() const
returns the box color
Definition: OctreeObject.h:281
[float x,y,z, padding]
Definition: PointCloudObjectBase.h:161
Generic Octree Implementation.
Definition: Octree.h:60
T * data()
return internal data pointer
Definition: FixedMatrix.h:453
Camera class.
Definition: Camera.h:132
Internal most common fill-Filter to filter out single points.
Definition: OctreeObject.h:223
virtual core::DataSegment< float, 3 > selectXYZ()
well know features XYZ (three floats, this feature must usually be available)
Definition: PointCloudObjectBase.h:230
void setRenderBoxes(bool enabled)
sets whether aabbs are to be rendered (default: true)
Definition: OctreeObject.h:266
Ipp32s icl32s
32bit signed integer type for the ICL
Definition: BasicTypes.h:58
OctreeObject(const Scalar &minX, const Scalar &minY, const Scalar &minZ, const Scalar &width, const Scalar &height, const Scalar &depth)
create OctreeObject from given axis-aligned bounding box
Definition: OctreeObject.h:150
bool operator()(const math::FixedColVector< float, N > &v) const
actual filter function
Definition: OctreeObject.h:244
math::Vec3 pos
position to filter out
Definition: OctreeObject.h:224
void renderNode(const typename Parent::Node *node) const
recursive render function rendering a node's AABB only
Definition: OctreeObject.h:350
virtual core::DataSegment< float, 4 > selectXYZH()
common way to store XYZ-data (4th float define homogeneous part)
Definition: PointCloudObjectBase.h:233
float getFocalLength() const
Definition: Camera.h:443
virtual void lock() const
locks the internal mutex if locking enabled is set to true
Definition: SceneObject.h:698
static T sqr(const T &x)
square template (faster than pow(x,2)
Definition: Macros.h:212
bool getRenderBoxes() const
return whether aabbs are rendered
Definition: OctreeObject.h:271
float sqrRadius
squared distance threshold to the filter point
Definition: OctreeObject.h:225
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
virtual void customRender()
adapted customRenderMethod
Definition: OctreeObject.h:297
bool getRenderPoints() const
return whether points are rendered as well
Definition: OctreeObject.h:261
void renderNodeWithPoints(const typename Parent::Node *node) const
recursive render function rendering a node's AABB and its points
Definition: OctreeObject.h:333
core::Color4D32f GeomColor
color for geometry primitives
Definition: GeomDefs.h:45
ICLQt_API void color(float r, float g=-1, float b=-1, float alpha=255)
sets the current color to given r,g,b,alpha value
bool m_renderBoxes
flag whether aabb boxes are rendered
Definition: OctreeObject.h:134
void box(const typename Parent::AABB &bb) const
utility function to render AABB-boxes
Definition: OctreeObject.h:325
virtual void unlock() const
unlocks the internal mutex if locking enabled is set to true
Definition: SceneObject.h:708
void setLockingEnabled(bool enabled)
sets locking enabled or disabled
Definition: SceneObject.h:682
GeomColor m_boxColor
color used for the aabb-boxes
Definition: OctreeObject.h:136
GeomColor getPointColor() const
returns the point rendering color
Definition: OctreeObject.h:292
PointFilter(const geom::Camera &cam)
Create point filter with given camera.
Definition: OctreeObject.h:236
The SceneObject class defines visible objects in scenes or scene graph nodes.
Definition: SceneObject.h:140
Node * root
root node pointer
Definition: Octree.h:238
[float x,y,z, homogenous part]
Definition: PointCloudObjectBase.h:162
void init()
Definition: OctreeObject.h:139
int getDim() const
returns the number of elements
Definition: DataSegmentBase.h:153
virtual bool supports(FeatureType t) const =0
interface for supported features