21#include <boost/format.hpp>
32 typedef Eigen::Matrix<size_t, 2, 1>
Vec2ui;
33 typedef Eigen::Matrix<size_t, 3, 1>
Vec3ui;
61 const Eigen::Vector2d&
min_range()
const {
return min_range_; }
68 const Eigen::Vector2d&
max_range()
const {
return max_range_; }
75 const Eigen::Vector2d&
cell_size()
const {
return cell_size_; }
96 const std::vector<uint64_t>&
bitmap()
const {
return bitmap_; }
103 int dir_major()
const {
return static_cast<int>(dir_major_); }
136 bool Empty()
const {
return bitmap_.empty(); }
145 bool IsExists(
const Eigen::Vector2d& p)
const;
154 bool Check(
const Eigen::Vector2d& p)
const;
161 void Set(
const Eigen::Vector2d& p);
168 void Reset(
const Eigen::Vector2d& p);
178 void Set(
const double x,
const double min_y,
const double max_y);
187 void Reset(
const double x,
const double min_y,
const double max_y);
197 out << boost::format(
198 "min_range: %lf %lf; max_range: %lf %lf;"
199 "cell_size: %lf %lf; dims: %d %d; dir_major: %s") %
204 (
bitmap.dir_major_ == DirectionMajor::XMAJOR ?
"x" :
"y");
210 inline bool CheckBit(
const size_t loc,
const uint64_t block)
const;
211 inline void SetBit(
const size_t loc, uint64_t* block);
212 inline void ResetBit(
const size_t loc, uint64_t* block);
214 inline void SetTailBits(
const size_t tail_num, uint64_t* block);
215 inline void ResetTailBits(
const size_t tail_num, uint64_t* block);
217 inline void SetHeadBits(
const size_t tail_num, uint64_t* block);
218 inline void ResetHeadBits(
const size_t tail_num, uint64_t* block);
220 inline void SetRangeBits(
const size_t head,
const size_t tail,
223 inline void ResetRangeBits(
const size_t head,
const size_t tail,
226 inline Vec3ui RealToBitmap(
const Eigen::Vector2d& p)
const;
227 inline int Index(
const Vec3ui& p)
const;
229 Eigen::Vector2d min_range_;
230 Eigen::Vector2d max_range_;
231 Eigen::Vector2d cell_size_;
236 std::vector<uint64_t> bitmap_;
virtual ~Bitmap2D()=default
Destroy the Bitmap 2D object
const Eigen::Vector2d & max_range() const
Return the max_range_
void Set(const Eigen::Vector2d &p)
Set the vector p
int dir_major() const
Return the dir_major_
void SetUp(const DirectionMajor dir_major)
Set the dir_major_ and op_dir_major_
DirectionMajor OppositeDirection(const DirectionMajor dir_major)
Opposite direction of direction_major
bool IsExists(const Eigen::Vector2d &p) const
check the vector p is in bitmap_
const Vec2ui & dims() const
Retrun the dims_
void Reset(const Eigen::Vector2d &p)
Reset the vector p
Bitmap2D()=default
Construct a new Bitmap 2D object
const Eigen::Vector2d & min_range() const
Return the min_range_
const std::vector< uint64_t > & bitmap() const
Return the bitmap_
friend std::ostream & operator<<(std::ostream &out, const Bitmap2D &bitmap)
print some meta data
int op_dir_major() const
Return the op_dir_major
Eigen::Matrix< size_t, 3, 1 > Vec3ui
void Init(const Eigen::Vector2d &min_range, const Eigen::Vector2d &max_range, const Eigen::Vector2d &cell_size)
Init of Bitmap 2D object
bool Empty() const
cehck the bitmap_ is emtpy
const Vec2ui & map_size() const
Return the map_size_
bool Check(const Eigen::Vector2d &p) const
Check the vector p
Eigen::Matrix< size_t, 2, 1 > Vec2ui
const Eigen::Vector2d & cell_size() const
Return the cell_size_