GCC Code Coverage Report


Directory: ./
File: include/hpp/pinocchio/liegroup/special-orthogonal.hh
Date: 2025-05-04 12:09:19
Exec Total Coverage
Lines: 6 7 85.7%
Branches: 0 0 -%

Line Branch Exec Source
1 // Copyright (c) 2017, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28
29 #ifndef HPP_PINOCCHIO_LIEGROUP_SPECIAL_ORTHOGONAL_OPERATION_HH
30 #define HPP_PINOCCHIO_LIEGROUP_SPECIAL_ORTHOGONAL_OPERATION_HH
31
32 #include <pinocchio/multibody/liegroup/special-orthogonal.hpp>
33
34 namespace hpp {
35 namespace pinocchio {
36 namespace liegroup {
37 template <int N>
38 struct SpecialOrthogonalOperation
39 : public ::pinocchio::SpecialOrthogonalOperationTpl<N, value_type> {
40 typedef ::pinocchio::SpecialOrthogonalOperationTpl<N, value_type> Base;
41 enum { BoundSize = 0, NR = Base::NV, NT = 0 };
42
43 template <class ConfigL_t, class ConfigR_t>
44 double squaredDistance(const Eigen::MatrixBase<ConfigL_t>& q0,
45 const Eigen::MatrixBase<ConfigR_t>& q1) {
46 return Base::squaredDistance(q0, q1);
47 }
48
49 template <class ConfigL_t, class ConfigR_t>
50 double squaredDistance(const Eigen::MatrixBase<ConfigL_t>& q0,
51 const Eigen::MatrixBase<ConfigR_t>& q1,
52 const typename ConfigL_t::Scalar& w) {
53 return w * squaredDistance(q0, q1);
54 }
55
56 template <class ConfigIn_t, class ConfigOut_t>
57 2 static void setBound(const Eigen::MatrixBase<ConfigIn_t>& bound,
58 const Eigen::MatrixBase<ConfigOut_t>& out) {
59 2 if (bound.size() == 0) return;
60 2 if (bound.size() != Base::NQ) {
61 HPP_THROW(std::invalid_argument, "Expected vector of size 0 or "
62 << (int)Base::NQ << ", got size "
63 << bound.size());
64 }
65 2 const_cast<Eigen::MatrixBase<ConfigOut_t>&>(out).head(bound.size()) = bound;
66 }
67
68 template <class JacobianIn_t, class JacobianOut_t>
69 static void getRotationSubJacobian(
70 const Eigen::MatrixBase<JacobianIn_t>& Jin,
71 const Eigen::MatrixBase<JacobianOut_t>& Jout) {
72 const_cast<Eigen::MatrixBase<JacobianOut_t>&>(Jout) = Jin;
73 }
74
75 template <class ConfigIn_t>
76 32137 static bool isNormalized(const Eigen::MatrixBase<ConfigIn_t>& q,
77 const value_type& eps) {
78 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ConfigIn_t, Base::ConfigVector_t);
79 32137 return (std::abs(q.norm() - 1) < eps);
80 }
81 };
82 } // namespace liegroup
83 } // namespace pinocchio
84 } // namespace hpp
85
86 #endif // HPP_PINOCCHIO_LIEGROUP_SPECIAL_ORTHOGONAL_OPERATION_HH
87