Commit d04c9922 authored by Michael Kuron's avatar Michael Kuron Committed by Sebastian Eibl
Browse files

change BodyTypeTuple of Union to variadic template

so Union<std::tuple<Sphere,Box>> becomes Union<Sphere,Box>
parent 098df370
......@@ -74,7 +74,7 @@ class Sphere;
class Spring;
class Squirmer;
class TriangleMesh;
template <typename BodyTypeTuple>
template <typename... BodyTypes>
class Union;
typedef RigidBody BodyType; //!< Type of the rigid bodies.
......
......@@ -38,8 +38,6 @@
#include "core/Abort.h"
#include <tuple>
namespace walberla {
namespace pe {
......
......@@ -31,6 +31,8 @@
#include "pe/communication/Marshalling.h"
#include "pe/rigidbody/Union.h"
#include <tuple>
namespace walberla {
namespace pe {
namespace communication {
......@@ -57,8 +59,8 @@ struct UnionParameters : public GeomPrimitiveParameters {
* \param obj The object to be marshalled.
* \return void
*/
template < typename BodyTypeTuple >
void marshal( mpi::SendBuffer& buffer, const Union<BodyTypeTuple>& obj )
template < typename... BodyTypes >
void marshal( mpi::SendBuffer& buffer, const Union<BodyTypes...>& obj )
{
// Material of union is not relevant for reconstruction thus marshal RigidBody instead of GeomPrimitive.
marshal( buffer, static_cast<const RigidBody&>( obj ) );
......@@ -72,12 +74,12 @@ void marshal( mpi::SendBuffer& buffer, const Union<BodyTypeTuple>& obj )
buffer << static_cast<size_t> (obj.size()); // Encoding the number of contained bodies
// Encoding the contained primitives
const typename Union<BodyTypeTuple>::const_iterator begin( obj.begin() );
const typename Union<BodyTypeTuple>::const_iterator end ( obj.end() );
for( typename Union<BodyTypeTuple>::const_iterator body=begin; body!=end; ++body )
const typename Union<BodyTypes...>::const_iterator begin( obj.begin() );
const typename Union<BodyTypes...>::const_iterator end ( obj.end() );
for( typename Union<BodyTypes...>::const_iterator body=begin; body!=end; ++body )
{
buffer << body->getTypeID();
MarshalDynamically<BodyTypeTuple>::execute( buffer, *body );
MarshalDynamically<std::tuple<BodyTypes...>>::execute( buffer, *body );
}
}
......@@ -109,13 +111,13 @@ void unmarshal( mpi::RecvBuffer& buffer, UnionParameters& objparam )
//*************************************************************************************************
template <typename BodyTypeTuple>
inline std::unique_ptr<Union<BodyTypeTuple>> instantiate( mpi::RecvBuffer& buffer, const math::AABB& domain, const math::AABB& block, Union<BodyTypeTuple>*& newBody )
template <typename... BodyTypes>
inline std::unique_ptr<Union<BodyTypes...>> instantiate( mpi::RecvBuffer& buffer, const math::AABB& domain, const math::AABB& block, Union<BodyTypes...>*& newBody )
{
UnionParameters subobjparam;
unmarshal( buffer, subobjparam );
correctBodyPosition(domain, block.center(), subobjparam.gpos_);
auto un = std::make_unique<Union<BodyTypeTuple>>( subobjparam.sid_,
auto un = std::make_unique<Union<BodyTypes...>>( subobjparam.sid_,
subobjparam.uid_,
subobjparam.gpos_,
subobjparam.rpos_,
......@@ -131,7 +133,7 @@ inline std::unique_ptr<Union<BodyTypeTuple>> instantiate( mpi::RecvBuffer& buffe
{
decltype ( static_cast<BodyID>(nullptr)->getTypeID() ) type;
buffer >> type;
BodyPtr obj( UnmarshalDynamically<BodyTypeTuple>::execute(buffer, type, domain, block) );
BodyPtr obj( UnmarshalDynamically<std::tuple<BodyTypes...>>::execute(buffer, type, domain, block) );
obj->setRemote( true );
un->add(std::move(obj));
}
......
......@@ -37,8 +37,6 @@
#include "core/math/Shims.h"
#include "geometry/GeometricalFunctions.h"
#include <tuple>
namespace walberla {
namespace pe {
namespace fcd {
......@@ -110,17 +108,17 @@ template <typename Container>
inline
bool collide( CapsuleID c, BoxID b, Container& container );
template <typename BodyTypeTuple, typename BodyB, typename Container>
template <typename... BodyTypes, typename BodyB, typename Container>
inline
bool collide( Union<BodyTypeTuple>* bd1, BodyB* bd2, Container& container );
bool collide( Union<BodyTypes...>* bd1, BodyB* bd2, Container& container );
template <typename BodyA, typename BodyTypeTuple, typename Container>
template <typename BodyA, typename... BodyTypes, typename Container>
inline
bool collide( BodyA* bd1, Union<BodyTypeTuple>* bd2, Container& container );
bool collide( BodyA* bd1, Union<BodyTypes...>* bd2, Container& container );
template <typename BodyTypeTupleA, typename BodyTypeTupleB, typename Container>
template <typename... BodyTypesA, typename... BodyTypesB, typename Container>
inline
bool collide( Union<BodyTypeTupleA>* bd1, Union<BodyTypeTupleB>* bd2, Container& container );
bool collide( Union<BodyTypesA...>* bd1, Union<BodyTypesB...>* bd2, Container& container );
} //namespace analytic
......@@ -2120,29 +2118,29 @@ bool collide( CapsuleID c, BoxID b, Container& container )
return collide(b, c, container);
}
template <typename BodyTypeTuple, typename BodyB, typename Container>
template <typename... BodyTypes, typename BodyB, typename Container>
inline
bool collide( Union<BodyTypeTuple>* bd1, BodyB* bd2, Container& container )
bool collide( Union<BodyTypes...>* bd1, BodyB* bd2, Container& container )
{
AnalyticSingleCollideFunctor<BodyB, Container> func(bd2, container);
bool collision = false;
for( auto it=bd1->begin(); it!=bd1->end(); ++it )
{
collision |= SingleCast<BodyTypeTuple, AnalyticSingleCollideFunctor<BodyB, Container>, bool>::execute(it.getBodyID(), func);
collision |= SingleCast<std::tuple<BodyTypes...>, AnalyticSingleCollideFunctor<BodyB, Container>, bool>::execute(it.getBodyID(), func);
}
return collision;
}
template <typename BodyA, typename BodyTypeTuple, typename Container>
template <typename BodyA, typename... BodyTypes, typename Container>
inline
bool collide( BodyA* bd1, Union<BodyTypeTuple>* bd2, Container& container )
bool collide( BodyA* bd1, Union<BodyTypes...>* bd2, Container& container )
{
return collide (bd2, bd1, container);
}
template <typename BodyTypeTupleA, typename BodyTypeTupleB, typename Container>
template <typename... BodyTypesA, typename... BodyTypesB, typename Container>
inline
bool collide( Union<BodyTypeTupleA>* bd1, Union<BodyTypeTupleB>* bd2, Container& container )
bool collide( Union<BodyTypesA...>* bd1, Union<BodyTypesB...>* bd2, Container& container )
{
AnalyticCollideFunctor<Container> func(container);
bool collision = false;
......@@ -2150,7 +2148,7 @@ bool collide( Union<BodyTypeTupleA>* bd1, Union<BodyTypeTupleB>* bd2, Container&
{
for( auto it2=bd2->begin(); it2!=bd2->end(); ++it2 )
{
collision |= DoubleCast<BodyTypeTupleA, BodyTypeTupleB, AnalyticCollideFunctor<Container>, bool>::execute(it1.getBodyID(), it2.getBodyID(), func);
collision |= DoubleCast<std::tuple<BodyTypesA...>, std::tuple<BodyTypesB...>, AnalyticCollideFunctor<Container>, bool>::execute(it1.getBodyID(), it2.getBodyID(), func);
}
}
return collision;
......
......@@ -28,7 +28,6 @@
#include "pe/rigidbody/Plane.h"
#include "pe/rigidbody/Union.h"
#include <pe/Thresholds.h>
#include <tuple>
namespace walberla{
namespace pe{
......@@ -50,25 +49,25 @@ namespace gjkepa{
inline bool generateContacts(Plane *a, Plane *b, Container& contacts_);
//Unions
template<typename BodyTupleA, typename BodyB, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, BodyB *b, Container& contacts_);
template<typename... BodyTypesA, typename BodyB, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, BodyB *b, Container& contacts_);
template<typename BodyA, typename BodyTupleB, typename Container>
inline bool generateContacts(BodyA *a, Union<BodyTupleB> *b, Container& contacts_);
template<typename BodyA, typename... BodyTypesB, typename Container>
inline bool generateContacts(BodyA *a, Union<BodyTypesB...> *b, Container& contacts_);
template<typename BodyTupleA, typename BodyTupleB, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, Union<BodyTupleB> *b, Container& contacts_);
template<typename... BodyTypesA, typename... BodyTypesB, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, Union<BodyTypesB...> *b, Container& contacts_);
//Union and Plane
template<typename BodyTupleA, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, Plane *b, Container& contacts_);
template<typename... BodyTypesA, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, Plane *b, Container& contacts_);
template<typename BodyTupleB, typename Container>
inline bool generateContacts(Plane *a, Union<BodyTupleB> *b, Container& contacts_);
template<typename... BodyTypesB, typename Container>
inline bool generateContacts(Plane *a, Union<BodyTypesB...> *b, Container& contacts_);
}
/* Iterative Collide Functor for contact Generation with iterative collision detection (GJK and EPA algorithms).
* Usage: fcd::GenericFCD<BodyTuple, fcd::GJKEPACollideFunctor> testFCD;
* Usage: fcd::GenericFCD<BodyTypes..., fcd::GJKEPACollideFunctor> testFCD;
* testFCD.generateContacts(...);
*/
template <typename Container>
......@@ -163,50 +162,50 @@ namespace gjkepa{
}
//Unions
template<typename BodyTupleA, typename BodyB, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, BodyB *b, Container& contacts_){
template<typename... BodyTypesA, typename BodyB, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, BodyB *b, Container& contacts_){
GJKEPASingleCollideFunctor<BodyB, Container> func(b, contacts_);
bool collision = false;
for( auto it=a->begin(); it!=a->end(); ++it )
{
collision |= SingleCast<BodyTupleA, GJKEPASingleCollideFunctor<BodyB, Container>, bool>::execute(it.getBodyID(), func);
collision |= SingleCast<std::tuple<BodyTypesA...>, GJKEPASingleCollideFunctor<BodyB, Container>, bool>::execute(it.getBodyID(), func);
}
return collision;
}
template<typename BodyA, typename BodyTupleB, typename Container>
inline bool generateContacts(BodyA *a, Union<BodyTupleB> *b, Container& contacts_){
template<typename BodyA, typename... BodyTypesB, typename Container>
inline bool generateContacts(BodyA *a, Union<BodyTypesB...> *b, Container& contacts_){
return generateContacts(b, a, contacts_);
}
template<typename BodyTupleA, typename BodyTupleB, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, Union<BodyTupleB> *b, Container& contacts_){
template<typename... BodyTypesA, typename... BodyTypesB, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, Union<BodyTypesB...> *b, Container& contacts_){
GJKEPACollideFunctor<Container> func(contacts_);
bool collision = false;
for( auto it1=a->begin(); it1!=a->end(); ++it1 )
{
for( auto it2=b->begin(); it2!=b->end(); ++it2 )
{
collision |= DoubleCast<BodyTupleA, BodyTupleB, GJKEPACollideFunctor<Container>, bool>::execute(it1.getBodyID(), it2.getBodyID(), func);
collision |= DoubleCast<std::tuple<BodyTypesA...>, std::tuple<BodyTypesB...>, GJKEPACollideFunctor<Container>, bool>::execute(it1.getBodyID(), it2.getBodyID(), func);
}
}
return collision;
}
//Union and Plane (these calls are ambigous if not implemented seperatly)
template<typename BodyTupleA, typename Container>
inline bool generateContacts(Union<BodyTupleA> *a, Plane *b, Container& contacts_){
template<typename... BodyTypesA, typename Container>
inline bool generateContacts(Union<BodyTypesA...> *a, Plane *b, Container& contacts_){
GJKEPASingleCollideFunctor<Plane, Container> func(b, contacts_);
bool collision = false;
for( auto it=a->begin(); it!=a->end(); ++it )
{
collision |= SingleCast<BodyTupleA, GJKEPASingleCollideFunctor<Plane, Container>, bool>::execute(it.getBodyID(), func);
collision |= SingleCast<std::tuple<BodyTypesA...>, GJKEPASingleCollideFunctor<Plane, Container>, bool>::execute(it.getBodyID(), func);
}
return collision;
}
template<typename BodyTupleB, typename Container>
inline bool generateContacts(Plane *a, Union<BodyTupleB> *b, Container& contacts_){
template<typename... BodyTypesB, typename Container>
inline bool generateContacts(Plane *a, Union<BodyTypesB...> *b, Container& contacts_){
return generateContacts(b, a, contacts_);
}
......
......@@ -23,7 +23,6 @@
#include "AnalyticCollisionDetection.h"
#include "GenericFCD.h"
#include <tuple>
#include <type_traits>
namespace walberla{
......
......@@ -30,7 +30,6 @@
#include "pe/rigidbody/Union.h"
#include "pe/utility/BodyCast.h"
#include <core/math/Utility.h>
#include <tuple>
#include <pe/raytracing/Ray.h>
......
......@@ -39,7 +39,7 @@
namespace walberla{
namespace pe{
template <typename BodyTypeTuple>
template <typename... BodyTypes>
class Union;
/**
......@@ -50,7 +50,7 @@ class RigidBody : public ccd::HashGridsBodyTrait
, private NonCopyable
{
private:
template <typename BodyTypeTuple>
template <typename... BodyTypes>
friend class Union;
protected:
......
......@@ -43,8 +43,6 @@
#include <iostream>
#include <stdexcept>
#include <tuple>
namespace walberla {
namespace pe {
......@@ -63,13 +61,10 @@ namespace pe {
* the basic functionality of a sphere. For a full description of the sphere geometry,
* see the Sphere class description.
*/
template <typename BodyTypeTuple>
template <typename... BodyTypes>
class Union : public RigidBody
{
public:
//**Type definitions****************************************************************************
using BodyTypeTupleT = BodyTypeTuple;
//**********************************************************************************************
using size_type = BodyStorage::size_type; //!< Size type of the body storage.
......@@ -232,8 +227,8 @@ private:
* \param communicating specifies if the sphere should take part in synchronization (syncNextNeighbour, syncShadowOwner)
* \param infiniteMass specifies if the sphere has infinite mass and will be treated as an obstacle
*/
template <typename BodyTypeTuple>
Union<BodyTypeTuple>::Union( id_t sid, id_t uid, const Vec3& gpos, const Vec3& rpos, const Quat& q,
template <typename... BodyTypes>
Union<BodyTypes...>::Union( id_t sid, id_t uid, const Vec3& gpos, const Vec3& rpos, const Quat& q,
const bool global, const bool communicating, const bool /*infiniteMass*/ )
: RigidBody( getStaticTypeID(), sid, uid ) // Initialization of the parent class
{
......@@ -265,8 +260,8 @@ Union<BodyTypeTuple>::Union( id_t sid, id_t uid, const Vec3& gpos, const Vec3& r
//*************************************************************************************************
/*!\brief Destructor for the Sphere class.
*/
template <typename BodyTypeTuple>
Union<BodyTypeTuple>::~Union()
template <typename... BodyTypes>
Union<BodyTypes...>::~Union()
{
// Clearing the bodies
bodies_.clear();
......@@ -281,8 +276,8 @@ Union<BodyTypeTuple>::~Union()
*
* \return The volume of the union.
*/
template <typename BodyTypeTuple>
inline real_t Union<BodyTypeTuple>::getVolume() const
template <typename... BodyTypes>
inline real_t Union<BodyTypes...>::getVolume() const
{
real_t volume(0);
for( auto bodyIt=bodies_.begin(); bodyIt!=bodies_.end(); ++bodyIt )
......@@ -302,8 +297,8 @@ inline real_t Union<BodyTypeTuple>::getVolume() const
* communication to set the remote status of a union within the simulation world. Using
* this function explicitly may lead to simulation errors during a parallel simulation!
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::setRemote( bool remote )
template <typename... BodyTypes>
void Union<BodyTypes...>::setRemote( bool remote )
{
remote_ = remote;
......@@ -322,8 +317,8 @@ void Union<BodyTypeTuple>::setRemote( bool remote )
* This function updates the axis-aligned bounding box of the union according to the current
* position and orientation of the contained rigid bodies.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::calcBoundingBox()
template <typename... BodyTypes>
void Union<BodyTypes...>::calcBoundingBox()
{
// Setting the bounding box of an empty union
if( bodies_.isEmpty() ) {
......@@ -356,8 +351,8 @@ void Union<BodyTypeTuple>::calcBoundingBox()
*
* \return void
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::calcCenterOfMass()
template <typename... BodyTypes>
void Union<BodyTypes...>::calcCenterOfMass()
{
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -440,8 +435,8 @@ void Union<BodyTypeTuple>::calcCenterOfMass()
*
* \return void
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::calcInertia()
template <typename... BodyTypes>
void Union<BodyTypes...>::calcInertia()
{
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -506,8 +501,8 @@ void Union<BodyTypeTuple>::calcInertia()
* rigid body, the function shifts the union to reposition its anchor point according to the
* given global coordinate.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::setPositionImpl( real_t px, real_t py, real_t pz )
template <typename... BodyTypes>
void Union<BodyTypes...>::setPositionImpl( real_t px, real_t py, real_t pz )
{
Vec3 gpos = Vec3( px, py, pz );
......@@ -521,7 +516,7 @@ void Union<BodyTypeTuple>::setPositionImpl( real_t px, real_t py, real_t pz )
for( auto& b : bodies_ )
b.update( dp );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalTranslation(); // Signaling the position change to the superordinate body
}
......@@ -544,8 +539,8 @@ void Union<BodyTypeTuple>::setPositionImpl( real_t px, real_t py, real_t pz )
* the anchor point of the union (if the union is infinite). The orientation of the rigid bodies
* within the union in reference to the body frame of the union is not changed.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::setOrientationImpl( real_t r, real_t i, real_t j, real_t k )
template <typename... BodyTypes>
void Union<BodyTypes...>::setOrientationImpl( real_t r, real_t i, real_t j, real_t k )
{
const Quat q ( r, i, j, k );
const Quat dq( q * q_.getInverse() );
......@@ -557,7 +552,7 @@ void Union<BodyTypeTuple>::setOrientationImpl( real_t r, real_t i, real_t j, rea
for( auto& b : bodies_ )
b.update( dq );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalRotation(); // Signaling the change of orientation to the superordinate body
}
......@@ -581,8 +576,8 @@ void Union<BodyTypeTuple>::setOrientationImpl( real_t r, real_t i, real_t j, rea
* movement. This movement involves a change in the global position and the axis-aligned
* bounding box.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::update( const Vec3& dp )
template <typename... BodyTypes>
void Union<BodyTypes...>::update( const Vec3& dp )
{
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -596,7 +591,7 @@ void Union<BodyTypeTuple>::update( const Vec3& dp )
b.update( dp );
// Setting the axis-aligned bounding box
Union<BodyTypeTuple>::calcBoundingBox();
Union<BodyTypes...>::calcBoundingBox();
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -614,8 +609,8 @@ void Union<BodyTypeTuple>::update( const Vec3& dp )
* This movement involves a change in the global position, the orientation/rotation and the
* axis-aligned bounding box of the box.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::update( const Quat& dq )
template <typename... BodyTypes>
void Union<BodyTypes...>::update( const Quat& dq )
{
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -633,7 +628,7 @@ void Union<BodyTypeTuple>::update( const Quat& dq )
b.update( dq );
// Setting the axis-aligned bounding box
Union<BodyTypeTuple>::calcBoundingBox();
Union<BodyTypes...>::calcBoundingBox();
// Checking the state of the union
WALBERLA_ASSERT( checkInvariants(), "Invalid union state detected" );
......@@ -699,8 +694,8 @@ void Union<BodyTypeTuple>::update( const Quat& dq )
* individually for the rigid body (to exclusively make the body (in-)visible) or the entire
* union (to make the entire union (in-)visible.
*/
template <typename BodyTypeTuple>
RigidBody& Union<BodyTypeTuple>::add( std::unique_ptr<RigidBody>&& body )
template <typename... BodyTypes>
RigidBody& Union<BodyTypes...>::add( std::unique_ptr<RigidBody>&& body )
{
// Checking for "self-assignment"
if( body.get() == BodyID( this ) ) return *this;
......@@ -770,8 +765,8 @@ RigidBody& Union<BodyTypeTuple>::add( std::unique_ptr<RigidBody>&& body )
* Changing the global position of the entire union's center of mass. All contained rigid bodies
* are moved by the same displacement.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::translateImpl( real_t dx, real_t dy, real_t dz )
template <typename... BodyTypes>
void Union<BodyTypes...>::translateImpl( real_t dx, real_t dy, real_t dz )
{
Vec3 dp(dx, dy, dz);
......@@ -782,7 +777,7 @@ void Union<BodyTypeTuple>::translateImpl( real_t dx, real_t dy, real_t dz )
for( auto& b : bodies_ )
b.update( dp );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalTranslation(); // Signaling the position change to the superordinate body
}
......@@ -809,8 +804,8 @@ void Union<BodyTypeTuple>::translateImpl( real_t dx, real_t dy, real_t dz )
* around the anchor point of the union (if the union is infinite). The orientation of the
* bodies within the union in reference to the body frame of the union is not changed.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::rotateImpl( const Quat& dq )
template <typename... BodyTypes>
void Union<BodyTypes...>::rotateImpl( const Quat& dq )
{
if (isFixed())
WALBERLA_ABORT("Trying to rotate a fixed body: " << *this);
......@@ -822,7 +817,7 @@ void Union<BodyTypeTuple>::rotateImpl( const Quat& dq )
for( auto& b : bodies_ )
b.update( dq );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalRotation(); // Signaling the change of orientation to the superordinate body
}
......@@ -843,8 +838,8 @@ void Union<BodyTypeTuple>::rotateImpl( const Quat& dq )
* are applied in the order x, y, z. The orientation of the bodies within the union in
* reference to the body frame of the union is not changed.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::rotateAroundOriginImpl( const Quat& dq )
template <typename... BodyTypes>
void Union<BodyTypes...>::rotateAroundOriginImpl( const Quat& dq )
{
q_ = dq * q_; // Updating the orientation of the union
R_ = q_.toRotationMatrix(); // Updating the rotation of the union
......@@ -854,7 +849,7 @@ void Union<BodyTypeTuple>::rotateAroundOriginImpl( const Quat& dq )
for( auto& b : bodies_ )
b.update( dq );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalTranslation(); // Signaling the position change to the superordinate body
}
......@@ -874,8 +869,8 @@ void Union<BodyTypeTuple>::rotateAroundOriginImpl( const Quat& dq )
* all contained rigid bodies change their position and orientation accordingly. The orientation
* of the bodies within the union in reference to the body frame of the union is not changed.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::rotateAroundPointImpl( const Vec3& point, const Quat &dq )
template <typename... BodyTypes>
void Union<BodyTypes...>::rotateAroundPointImpl( const Vec3& point, const Quat &dq )
{
const Vec3 dp( gpos_ - point );
......@@ -887,7 +882,7 @@ void Union<BodyTypeTuple>::rotateAroundPointImpl( const Vec3& point, const Quat
for( auto& b : bodies_ )
b.update( dq );
Union<BodyTypeTuple>::calcBoundingBox(); // Setting the axis-aligned bounding box
Union<BodyTypes...>::calcBoundingBox(); // Setting the axis-aligned bounding box
wake(); // Waking the union from sleep mode
signalTranslation(); // Signaling the position change to the superordinate body
}
......@@ -910,8 +905,8 @@ void Union<BodyTypeTuple>::rotateAroundPointImpl( const Vec3& point, const Quat
* \param pz The z-component of the relative coordinate.
* \return \a true if the point lies inside the sphere, \a false if not.
*/
template <typename BodyTypeTuple>
bool Union<BodyTypeTuple>::containsRelPointImpl( real_t px, real_t py, real_t pz ) const
template <typename... BodyTypes>
bool Union<BodyTypes...>::containsRelPointImpl( real_t px, real_t py, real_t pz ) const
{
const Vec3 gpos( pointFromBFtoWF( px, py, pz ) );
for( auto& b : bodies_ )
......@@ -931,8 +926,8 @@ bool Union<BodyTypeTuple>::containsRelPointImpl( real_t px, real_t py, real_t pz
*
* The tolerance level of the check is pe::surfaceThreshold.
*/
template <typename BodyTypeTuple>
bool Union<BodyTypeTuple>::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const
template <typename... BodyTypes>
bool Union<BodyTypes...>::isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const
{
bool surface( false );
const Vec3 gpos( pointFromBFtoWF( px, py, pz ) );
......@@ -964,8 +959,8 @@ bool Union<BodyTypeTuple>::isSurfaceRelPointImpl( real_t px, real_t py, real_t p
* In case one of the contained rigid bodies is interally modified, this function is called to
* recalculate the changed properties of the union.
*/
template <typename BodyTypeTuple>
void Union<BodyTypeTuple>::handleModification()
template <typename... BodyTypes>
void Union<BodyTypes...>::handleModification()