cross_implementation.h 868 Bytes
Newer Older
Steve T's avatar
Steve T committed
1
/**
Steve T's avatar
Steve T committed
2
 * \file cross_implementation.h
Steve T's avatar
Steve T committed
3
 * \brief class allowing to create a cubic hermite spline of any dimension.
Steve T's avatar
Steve T committed
4
5
 * \author Steve Tonneau
 * \date 09/2020
Steve T's avatar
Steve T committed
6
7
8
9
10
 */

#ifndef _CLASS_CROSSIMP
#define _CLASS_CROSSIMP

Steve T's avatar
Steve T committed
11
#include "ndcurves/fwd.h"
Steve T's avatar
Steve T committed
12

Steve T's avatar
Steve T committed
13
namespace ndcurves {
14
15
inline
Eigen::Vector3d cross(const Eigen::VectorXd& a, const Eigen::VectorXd& b){
Steve T's avatar
Steve T committed
16
17
18
19
    Eigen::Vector3d c;
    c << a[1]*b[2] - a[2]*b[1], a[2]*b[0] - a[0]*b[2], a[0]*b[1] - a[1]*b[0] ;
    return c;
}
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

inline
Eigen::Vector3d cross(const Eigen::Vector3d& a, const Eigen::Vector3d& b){
    return a.cross(b);
}

inline
Eigen::Vector3f cross(const Eigen::Vector3f& a, const Eigen::Vector3f& b){
    return a.cross(b);
}

template<typename N, bool S>
linear_variable<N,S> cross(const linear_variable<N,S>& a, const linear_variable<N,S>& b){
    return a.cross(b);
}
Steve T's avatar
Steve T committed
35
}  // namespace ndcurves
Steve T's avatar
Steve T committed
36
#endif  //_CLASS_CROSSIMP