\brief Functor to compute the derivatives of a contact patch.
| 88 | #ifndef SIMPLE_SKIP_COLLISION_DERIVATIVES_CONTRIBUTIONS |
| 89 | /// \brief Functor to compute the derivatives of a contact patch. |
| 90 | struct ComputeContactPatchDerivative : ::diffcoal::ComputeContactPatchDerivative |
| 91 | { |
| 92 | using Base = ::diffcoal::ComputeContactPatchDerivative; |
| 93 | using GeometryObject = ::pinocchio::GeometryObject; |
| 94 | |
| 95 | ComputeContactPatchDerivative(const GeometryObject & go1, const GeometryObject & go2) |
| 96 | : Base(go1.geometry.get(), go2.geometry.get()) |
| 97 | , go1_ptr(&go1) |
| 98 | , go2_ptr(&go2) |
| 99 | { |
| 100 | } |
| 101 | |
| 102 | virtual ~ComputeContactPatchDerivative() {}; |
| 103 | |
| 104 | virtual void run( |
| 105 | const ::hpp::fcl::Transform3f & M1, |
| 106 | const ::hpp::fcl::Transform3f & M2, |
| 107 | const ::hpp::fcl::ContactPatch & patch, |
| 108 | const ::diffcoal::ContactPatchDerivativeRequest & drequest, |
| 109 | ::diffcoal::ContactPatchDerivative & dpatch) const override |
| 110 | { |
| 111 | typedef ::hpp::fcl::CollisionGeometry const * Pointer; |
| 112 | const_cast<Pointer &>(Base::geom1) = go1_ptr->geometry.get(); |
| 113 | const_cast<Pointer &>(Base::geom2) = go2_ptr->geometry.get(); |
| 114 | return Base::run(M1, M2, patch, drequest, dpatch); |
| 115 | } |
| 116 | |
| 117 | bool operator==(const ComputeContactPatchDerivative & other) const |
| 118 | { |
| 119 | return Base::operator==(other) && go1_ptr == other.go1_ptr && go2_ptr == other.go2_ptr; // Maybe, it would be better to just check |
| 120 | // *go2_ptr == *other.go2_ptr |
| 121 | } |
| 122 | |
| 123 | bool operator!=(const ComputeContactPatchDerivative & other) const |
| 124 | { |
| 125 | return !(*this == other); |
| 126 | } |
| 127 | |
| 128 | const GeometryObject & getGeometryObject1() const |
| 129 | { |
| 130 | return *go1_ptr; |
| 131 | } |
| 132 | const GeometryObject & getGeometryObject2() const |
| 133 | { |
| 134 | return *go2_ptr; |
| 135 | } |
| 136 | |
| 137 | protected: |
| 138 | const GeometryObject * go1_ptr; |
| 139 | const GeometryObject * go2_ptr; |
| 140 | }; |
| 141 | #endif |
| 142 | |
| 143 | } // namespace simple |
nothing calls this directly
no outgoing calls
no test coverage detected