From 2d8d20700d85dd3553400bf5db796ffeff6677f9 Mon Sep 17 00:00:00 2001 From: sarthou Date: Thu, 24 Aug 2023 15:47:52 +0200 Subject: [PATCH] [FieldOfView] margin on hasIn --- include/overworld/BasicTypes/FieldOfView.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/overworld/BasicTypes/FieldOfView.h b/include/overworld/BasicTypes/FieldOfView.h index 171d990e..26f274a2 100644 --- a/include/overworld/BasicTypes/FieldOfView.h +++ b/include/overworld/BasicTypes/FieldOfView.h @@ -27,7 +27,7 @@ class FieldOfView double getClipFar() const { return clip_far_; } double getRatio() const { return width_ / height_; } - double getRatioOpenGl() const { return opengl_ratio_ } + double getRatioOpenGl() const { return opengl_ratio_; } //double getRatioOpenGl() const { return 1.4227 * std::tan(width_ / height_ * 0.6105); } /** @@ -37,10 +37,10 @@ class FieldOfView * @return true * @return false */ - inline bool hasIn(const Pose& pose) const + inline bool hasIn(const Pose& pose, double margin = 0.) const { - return pose.getZ() <= clip_far_ && std::abs(pose.getOriginTilt()) <= height_ * TO_HALF_RAD && - std::abs(pose.getOriginPan()) <= width_ * TO_HALF_RAD; + return pose.getZ() <= clip_far_ && std::abs(pose.getOriginTilt()) <= (height_ - margin*2) * TO_HALF_RAD && + std::abs(pose.getOriginPan()) <= (width_ - margin*2) * TO_HALF_RAD; } std::string toString() const