Directory: | ./ |
---|---|
File: | src/substraction-visitor.hh |
Date: | 2025-05-04 12:09:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 8 | 8 | 100.0% |
Branches: | 5 | 13 | 38.5% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2017, CNRS | ||
2 | // Authors: Florent Lamiraux | ||
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_SRC_SUBSTRACTION_VISITOR_HH | ||
30 | #define HPP_PINOCCHIO_SRC_SUBSTRACTION_VISITOR_HH | ||
31 | |||
32 | namespace hpp { | ||
33 | namespace pinocchio { | ||
34 | namespace liegroupType { | ||
35 | |||
36 | typedef Eigen::Quaternion<value_type> quaternion_t; | ||
37 | |||
38 | /// Substraction visitor | ||
39 | template <typename vector_type1, typename vector_type2> | ||
40 | struct SubstractionVisitor : public boost::static_visitor<> { | ||
41 | 800 | SubstractionVisitor(const vector_type1& e1, const vector_type2& e2, | |
42 | vector_t& res) | ||
43 | 800 | : e1_(e1), e2_(e2), result(res), iq_(0), iv_(0) {} | |
44 | template <typename LiegroupType> | ||
45 | 800 | void operator()(LiegroupType& op) { | |
46 |
3/8✓ Branch 1 taken 400 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 400 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 400 times.
✗ Branch 8 not taken.
|
800 | op.difference(e2_.template segment<LiegroupType::NQ>(iq_, op.nq()), |
47 |
2/5✓ Branch 1 taken 400 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 400 times.
✗ Branch 5 not taken.
|
800 | e1_.template segment<LiegroupType::NQ>(iq_, op.nq()), |
48 | 800 | result.segment<LiegroupType::NV>(iv_, op.nv())); | |
49 | |||
50 | 800 | iq_ += op.nq(); | |
51 | 800 | iv_ += op.nv(); | |
52 | } | ||
53 | const vector_type1& e1_; | ||
54 | const vector_type2& e2_; | ||
55 | vector_t& result; | ||
56 | size_type iq_, iv_; | ||
57 | }; // struct SubstractionVisitor | ||
58 | } // namespace liegroupType | ||
59 | } // namespace pinocchio | ||
60 | } // namespace hpp | ||
61 | |||
62 | #endif // HPP_PINOCCHIO_SRC_SUBSTRACTION_VISITOR_HH | ||
63 |