34 #ifndef OCTOMAP_COLOR_OCTREE_H 35 #define OCTOMAP_COLOR_OCTREE_H 51 Color(
unsigned char _r,
unsigned char _g,
unsigned char _b)
52 :
r(_r),
g(_g),
b(_b) {}
54 return (
r==other.
r &&
g==other.
g &&
b==other.
b);
57 return (
r!=other.
r ||
g!=other.
g ||
b!=other.
b);
59 unsigned char r,
g,
b;
90 inline void setColor(
unsigned char r,
unsigned char g,
unsigned char b) {
107 std::istream&
readValue (std::istream &s);
108 std::ostream&
writeValue(std::ostream &s)
const;
130 const unsigned char&
g,
const unsigned char&
b);
133 const float& z,
const unsigned char& r,
134 const unsigned char& g,
const unsigned char& b) {
136 if (!this->coordToKeyChecked(
point3d(x,y,z), key))
return NULL;
137 return setNodeColor(key,r,g,b);
142 const unsigned char& g,
const unsigned char& b);
145 const float& z,
const unsigned char& r,
146 const unsigned char& g,
const unsigned char& b) {
148 if (!this->coordToKeyChecked(
point3d(x,y,z), key))
return NULL;
149 return averageNodeColor(key,r,g,b);
154 const unsigned char& g,
const unsigned char& b);
157 const float& z,
const unsigned char& r,
158 const unsigned char& g,
const unsigned char& b) {
160 if (!this->coordToKeyChecked(
point3d(x,y,z), key))
return NULL;
161 return integrateNodeColor(key,r,g,b);
165 void updateInnerOccupancy();
168 void writeColorHistogram(std::string filename);
171 void updateInnerOccupancyRecurs(
ColorOcTreeNode* node,
unsigned int depth);
static void registerTreeType(AbstractOcTree *tree)
const ColorOcTreeNode * getChild(unsigned int i) const
ColorOcTreeNode::Color getAverageChildColor() const
T value
stored data (payload)
bool operator==(const Color &other) const
OcTreeNode * getChild(unsigned int i)
ColorOcTree * create() const
bool operator!=(const Color &other) const
void updateColorChildren()
std::string getTreeType() const
returns actual class name as string for identification
ColorOcTreeNode * getChild(unsigned int i)
std::ostream & operator<<(std::ostream &out, ColorOcTreeNode::Color const &c)
user friendly output in format (r g b)
OcTreeDataNode< float > ** children
pointer to array of children, may be NULL
Color(unsigned char _r, unsigned char _g, unsigned char _b)
std::istream & readValue(std::istream &s)
ColorOcTreeNode * integrateNodeColor(const float &x, const float &y, const float &z, const unsigned char &r, const unsigned char &g, const unsigned char &b)
ColorOcTreeNode * setNodeColor(const float &x, const float &y, const float &z, const unsigned char &r, const unsigned char &g, const unsigned char &b)
bool operator==(const ColorOcTreeNode &rhs) const
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
bool createChild(unsigned int i)
StaticMemberInitializer()
std::ostream & writeValue(std::ostream &s) const
ColorOcTreeNode * averageNodeColor(const float &x, const float &y, const float &z, const unsigned char &r, const unsigned char &g, const unsigned char &b)
static StaticMemberInitializer colorOcTreeMemberInit
static member to ensure static initialization (only once)
ColorOcTreeNode(const ColorOcTreeNode &rhs)
void setColor(unsigned char r, unsigned char g, unsigned char b)