1 #include <fcl/narrowphase/collision.h> 2 #include <fcl/narrowphase/collision_object.h> 26 const Eigen::Vector2d &point2,
27 std::vector<LineSegment> &intersect)
const {
30 std::vector<Eigen::Vector2d> inters1;
32 for (
auto &segm : segments_) {
33 res = segm.intersect(obj_segment, inters1) || res;
56 <<
") r: (" << r_(0) <<
"|" << r_(1) <<
") " 57 <<
"min: (" << min_(0) <<
"|" << min_(1) <<
") " 58 <<
"max: (" << max_(0) <<
"|" << max_(1) <<
")" << std::endl;
74 throw "Rectangle_OBB: Not a valid index for r";
114 min_(0) = center_x -
r_x;
115 max_(0) = center_x +
r_x;
119 min_(1) = center_y -
r_y;
120 max_(1) = center_y +
r_y;
126 for (
int i = 0; i < 2; i++) {
127 if (p(i) < min_(i)) {
128 sq_dis += pow(min_(i) - p(i), 2);
129 }
else if (p(i) > max_(i)) {
130 sq_dis += pow(p(i) - max_(i), 2);
136 #if ENABLE_SERIALIZER 143 return serialize::exportObject(*
this);
void set_r(const Eigen::Vector2d &_r)
double squareDisToPoint(const Eigen::Vector2d &p) const
Eigen::Vector2d r() const
void print(std::ostringstream &stream) const
Print all parameters of the shape.
bool rayTrace(const Eigen::Vector2d &point1, const Eigen::Vector2d &point2, std::vector< LineSegment > &intersect) const override
bool rayTracePostprocess(const Eigen::Vector2d &point1, const Eigen::Vector2d &point2, std::vector< Eigen::Vector2d > inters1, std::vector< LineSegment > &intersect, const collision::CollisionObject *obj)
void invalidateCollisionEntityCache(void)
RectangleAABB * clone() const
fcl::CollisionObject< FCL_PRECISION > * createFCLCollisionObject(const std::shared_ptr< fcl::CollisionGeometry< FCL_PRECISION >> &col_geom) const override
Eigen::Vector2d min() const
fcl::CollisionGeometry< FCL_PRECISION > * createFCLCollisionGeometry(void) const override
void set_r_x(double _r_x)
void set_r_y(double _r_y)
ShapeType type() const
Get shape type.
void set_all(double r_x, double r_y, double center_x, double center_y)
double radius() const
Get radius.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW RectangleAABB(double _rx, double _ry, const Eigen::Vector2d &_center=Eigen::Vector2d(0, 0))
Base prototype for the shape of an obstacle.
int serialize(const test::BroadphaseFailureCCObj &bf_object, std::ostream &output_stream, const char *format=SERIALIZER_DEFAULT_FORMAT)
std::vector< LineSegment > segments(void) const
Eigen::Vector2d max() const
Eigen::Vector2d center() const
Get geometric center of shape.
void set_center(const Eigen::Vector2d &_center)