Verified Commit 7a2dd4d2 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: add new constructor for CollisionPair

parent b3429ac9
......@@ -52,11 +52,22 @@
namespace pinocchio
{
struct CollisionPair: public std::pair<GeomIndex, GeomIndex>
struct CollisionPair
: public std::pair<GeomIndex, GeomIndex>
{
typedef std::pair<GeomIndex, GeomIndex> Base;
/// \brief Empty constructor
CollisionPair();
///
/// \brief Default constructor of a collision pair from two collision object indexes.
/// \remarks The two indexes must be different, otherwise the constructor throws.
///
/// \param[in] co1 Index of the first collision object.
/// \param[in] co2 Index of the second collision object.
///
CollisionPair(const GeomIndex co1, const GeomIndex co2);
bool operator == (const CollisionPair& rhs) const;
bool operator != (const CollisionPair& rhs) const;
......
//
// Copyright (c) 2015-2019 CNRS INRIA
// Copyright (c) 2015-2021 CNRS INRIA
//
#ifndef __pinocchio_multibody_fcl_hxx__
#define __pinocchio_multibody_fcl_hxx__
#include <ostream>
#include <limits>
namespace pinocchio
{
///
/// \brief Default constructor of a collision pair from two collision object indexes.
/// \remarks The two indexes must be different, otherwise the constructor throws.
///
/// \param[in] co1 Index of the first collision object.
/// \param[in] co2 Index of the second collision object.
///
inline CollisionPair::CollisionPair()
: Base((std::numeric_limits<GeomIndex>::max)(),(std::numeric_limits<GeomIndex>::max)())
{}
inline CollisionPair::CollisionPair(const GeomIndex co1, const GeomIndex co2)
: Base(co1,co2)
{
......@@ -29,6 +27,11 @@ namespace pinocchio
|| (first == rhs.second && second == rhs.first );
}
inline bool CollisionPair::operator!=(const CollisionPair& other) const
{
return !(*this == other);
}
inline void CollisionPair::disp(std::ostream & os) const
{ os << "collision pair (" << first << "," << second << ")\n"; }
......
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