faunus
Public Member Functions | Public Attributes | List of all members
Faunus::Geometry::TwobodyAngles Class Reference

Structure for exploring a discrete, uniform angular space between two rigid bodies. More...

#include <geometry.h>

Inheritance diagram for Faunus::Geometry::TwobodyAngles:
Inheritance graph
[legend]

Public Member Functions

 TwobodyAngles (double angle_resolution)
 
auto quaternionPairs () const
 Iterator to loop over pairs of quaternions to rotate two rigid bodies against each other. More...
 
size_t size () const
 Total number of points in angular space (i.e. the number of unique poses)
 

Public Attributes

std::vector< Eigen::Quaterniond > quaternions_1
 Quaternions to explore all Euler angles.
 
std::vector< Eigen::Quaterniond > quaternions_2
 Quaternions to explore all Euler angles.
 
std::vector< Eigen::Quaterniond > dihedrals
 Quaternions to explore all dihedral angles.
 

Detailed Description

Structure for exploring a discrete, uniform angular space between two rigid bodies.

Quaternions for visiting all poses in angular space can be generated in several ways:

TwobodyAngles angles(0.1);
// Visit all poses via pairs of iterators
for (const auto& [q1, q2] : angles.quaternionPairs()) {
pos1 = q1 * pos1; // first body
pos2 = q2 * pos2; // second body
}
// Visit all poses via triplets of iterators. May be useful for parallel execution
// Note that quaternion multiplication is noncommutative so keep the shown order.
for (const auto &q_euler1 : angles.quaternions1) {
for (const auto &q_euler2 : angles.quaternions2) {
for (const auto &q_dihedral : angles.dihedrals) {
pos1 = q_euler1 * pos1; // first body
pos2 = (q_dihedral * q_euler2) * pos2; // second body
}
}
}

Member Function Documentation

◆ quaternionPairs()

auto Faunus::Geometry::TwobodyAngles::quaternionPairs ( ) const
inline

Iterator to loop over pairs of quaternions to rotate two rigid bodies against each other.

The second quaternion in the pair includes dihedral rotations, i.e. the pair is q1, q_dihedral * q2.


The documentation for this class was generated from the following files: