Verified Commit d334fa57 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

fcl: fix issue of vanishing pointers

parent 748992f1
......@@ -278,25 +278,26 @@ PINOCCHIO_COMPILER_DIAGNOSTIC_POP
: ::hpp::fcl::ComputeCollision
{
typedef ::hpp::fcl::ComputeCollision Base;
typedef boost::shared_ptr<const fcl::CollisionGeometry> ConstCollisionGeometryPtr;
ComputeCollision(const GeometryObject & o1, const GeometryObject & o2)
: Base(o1.geometry.get(),o2.geometry.get())
, o1(&o1)
, o2(&o2)
, o1(o1.geometry)
, o2(o2.geometry)
{}
virtual ~ComputeCollision() {};
protected:
const GeometryObject * o1;
const GeometryObject * o2;
ConstCollisionGeometryPtr o1;
ConstCollisionGeometryPtr o2;
virtual std::size_t run(const fcl::Transform3f& tf1, const fcl::Transform3f& tf2,
const fcl::CollisionRequest& request, fcl::CollisionResult& result) const
{
typedef ::hpp::fcl::CollisionGeometry const * Pointer;
const_cast<Pointer&>(Base::o1) = o1->geometry.get();
const_cast<Pointer&>(Base::o2) = o2->geometry.get();
const_cast<Pointer&>(Base::o1) = o1.get();
const_cast<Pointer&>(Base::o2) = o2.get();
return Base::run(tf1, tf2, request, result);
}
};
......@@ -305,25 +306,26 @@ PINOCCHIO_COMPILER_DIAGNOSTIC_POP
: ::hpp::fcl::ComputeDistance
{
typedef ::hpp::fcl::ComputeDistance Base;
typedef boost::shared_ptr<fcl::CollisionGeometry> ConstCollisionGeometryPtr;
ComputeDistance(const GeometryObject & o1, const GeometryObject & o2)
: Base(o1.geometry.get(),o2.geometry.get())
, o1(&o1)
, o2(&o2)
, o1(o1.geometry)
, o2(o2.geometry)
{}
virtual ~ComputeDistance() {};
protected:
const GeometryObject * o1;
const GeometryObject * o2;
ConstCollisionGeometryPtr o1;
ConstCollisionGeometryPtr o2;
virtual hpp::fcl::FCL_REAL run(const fcl::Transform3f& tf1, const fcl::Transform3f& tf2,
const fcl::DistanceRequest& request, fcl::DistanceResult& result) const
{
typedef ::hpp::fcl::CollisionGeometry const * Pointer;
const_cast<Pointer&>(Base::o1) = o1->geometry.get();
const_cast<Pointer&>(Base::o2) = o2->geometry.get();
const_cast<Pointer&>(Base::o1) = o1.get();
const_cast<Pointer&>(Base::o2) = o2.get();
return Base::run(tf1, tf2, request, result);
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment