Reverted planemap
This commit is contained in:
@@ -74,10 +74,8 @@
|
||||
#define PLANEMAP_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "util.hpp"
|
||||
|
||||
class PlaneMap;
|
||||
|
||||
@@ -87,38 +85,20 @@ class PlaneItem {
|
||||
private:
|
||||
PlaneMap *pmap_;
|
||||
std::string plane_;
|
||||
util::XYZ xyz_;
|
||||
double x_, y_, z_;
|
||||
|
||||
public:
|
||||
PlaneItem();
|
||||
~PlaneItem();
|
||||
|
||||
const std::string &plane() const { return plane_; }
|
||||
const util::XYZ &xyz() const { return xyz_; }
|
||||
const float x() const { return xyz_.x; }
|
||||
const float y() const { return xyz_.y; }
|
||||
const float z() const { return xyz_.z; }
|
||||
const double x() const { return x_; }
|
||||
const double y() const { return y_; }
|
||||
const double z() const { return z_; }
|
||||
|
||||
void untrack();
|
||||
void set_pos(const std::string &plane, const util::XYZ &xyz);
|
||||
void set_pos(const std::string &plane, float x, float y, float z) { set_pos(plane, util::XYZ(x,y,z)); }
|
||||
void set_xyz(const util::XYZ &xyz) { set_pos(plane_, xyz); }
|
||||
void set_xyz(float x, float y, float z) { set_pos(plane_, util::XYZ(x, y, z)); }
|
||||
|
||||
// Assume that some other object has methods 'get_plane' and 'get_xyz'.
|
||||
// Get the plane and XYZ from that object and store it in this PlaneItem.
|
||||
template<class T>
|
||||
void set_pos_from(const T &obj) {
|
||||
set_pos(obj.get_plane(), obj.get_xyz());
|
||||
}
|
||||
|
||||
// Assume that the PlaneItem is a field in an object of class T.
|
||||
// Static cast the PlaneItem pointer to a type T pointer.
|
||||
template<class T>
|
||||
T *static_field_cast() {
|
||||
const std::size_t offset = offsetof(T, plane_item_);
|
||||
return reinterpret_cast<T*>(reinterpret_cast<char*>(this) - offset);
|
||||
}
|
||||
void set_pos(const std::string &plane, double x, double y, double z);
|
||||
void set_xyz(double x, double y, double z) { set_pos(plane_, x, y, z); }
|
||||
};
|
||||
|
||||
class PlaneMap {
|
||||
@@ -134,7 +114,7 @@ public:
|
||||
PlaneMap();
|
||||
~PlaneMap();
|
||||
void track(PlaneItem *item);
|
||||
EltVec scan_radius(const std::string &plane, float x, float y, float radius) const;
|
||||
EltVec scan_radius(const std::string &plane, double x, double y, double radius) const;
|
||||
|
||||
private:
|
||||
// unit testing stuff.
|
||||
|
||||
Reference in New Issue
Block a user