16 const size_t constrIndex,
20 std::array<Eigen::Matrix3<T>, 2>& dfdv)
const {
27 const T projLength = v[1].dot(tgtVec);
30 f = projLength * v[1] - tgtVec;
32 dfdv[0].setIdentity();
33 dfdv[0].noalias() -= v[1] * v[1].transpose();
35 dfdv[1].noalias() = v[1] * tgtVec.transpose();
36 dfdv[1].diagonal().array() += projLength;
41 const size_t constrIndex,
45 std::array<Eigen::Matrix3<T>, 2>& dfdv)
const {
52 const T tgtNorm = tgtVec.norm();
54 if (tgtNorm > 1e-16) {
55 tgtDir = tgtVec / tgtNorm;
62 if (tgtNorm > 1e-16) {
63 dfdv[0].noalias() -= (tgtDir * tgtDir.transpose()) / tgtNorm;
64 dfdv[0].diagonal().array() += T(1) / tgtNorm;
66 dfdv[1].setIdentity();
void evalFunction(size_t constrIndex, const JointStateT< T > &state, Vector3< T > &f, std::array< Vector3< T >, 2 > &v, std::array< Eigen::Matrix3< T >, 2 > &dfdv) const final
The AimDistErrorFunction computes the distance from the aim target point to an aim ray (an original a...
void evalFunction(size_t constrIndex, const JointStateT< T > &state, Vector3< T > &f, std::array< Vector3< T >, 2 > &v, std::array< Eigen::Matrix3< T >, 2 > &dfdv) const final
std::vector< AimDataT< T > > constraints_
Profiling macros that dispatch to one of three backends, selected at compile time:
#define MT_PROFILE_FUNCTION()
Aim constraint data: a local ray (point, dir) passes a global point target.
Vector3< T > localDir
The direction of the local ray.
Vector3< T > localPoint
The origin of the local ray.
Vector3< T > globalTarget
The global aim target.
Represents the state of a joint with local and global transformations.
TransformT< T > transform
Global transformation in world space.
const Quaternion< T > & rotation() const
Access the joint's global rotation quaternion.