44 #ifndef FASTRACK_BOUND_BOX_H 45 #define FASTRACK_BOUND_BOX_H 50 #include <fastrack_srvs/TrackingBoundBox.h> 51 #include <fastrack_srvs/TrackingBoundBoxResponse.h> 65 if (params.size() != 3) {
66 ROS_ERROR(
"Box: params were incorrect size.");
77 inline void FromRos(
const fastrack_srvs::TrackingBoundBox::Response& res) {
84 inline fastrack_srvs::TrackingBoundBox::Response
ToRos()
const {
85 fastrack_srvs::TrackingBoundBox::Response res;
95 double radius)
const {
96 const Vector3d closest_point(
97 std::min(p(0) + x, std::max(p(0) - x, center(0))),
98 std::min(p(1) + y, std::max(p(1) - y, center(1))),
99 std::min(p(2) + z, std::max(p(2) - z, center(2))));
100 return (closest_point - center).squaredNorm() <= radius * radius;
104 const Vector3d& upper)
const {
105 return !(p(0) + x < lower(0) || p(0) - x > upper(0) ||
106 p(1) + y < lower(1) || p(1) - y > upper(1) ||
107 p(2) + z < lower(2) || p(2) - z > upper(2));
113 const Vector3d& upper)
const {
114 return p(0) >= lower(0) + x && p(0) <= upper(0) - x &&
115 p(1) >= lower(1) + y && p(1) <= upper(1) - y &&
116 p(2) >= lower(2) + z && p(2) <= upper(2) -
z;
121 const std::string& frame)
const {
122 visualization_msgs::Marker m;
124 m.header.frame_id = frame;
125 m.header.stamp = ros::Time::now();
127 m.type = visualization_msgs::Marker::CUBE;
128 m.action = visualization_msgs::Marker::ADD;
bool Initialize(const std::vector< double > ¶ms)
bool OverlapsBox(const Vector3d &p, const Vector3d &lower, const Vector3d &upper) const
bool OverlapsSphere(const Vector3d &p, const Vector3d ¢er, double radius) const
bool ContainedWithinBox(const Vector3d &p, const Vector3d &lower, const Vector3d &upper) const
void FromRos(const fastrack_srvs::TrackingBoundBox::Response &res)
void Visualize(const ros::Publisher &pub, const std::string &frame) const
fastrack_srvs::TrackingBoundBox::Response ToRos() const