OSVR-Core
CrossProductMatrix.h
Go to the documentation of this file.
1 
11 // Copyright 2016 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
26 #define INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
27 
28 // Internal Includes
29 // - none
30 
31 // Library/third-party includes
33 
34 // Standard includes
35 // - none
36 
37 namespace osvr {
38 namespace vbtracker {
39  template <typename Derived>
41  skewSymmetricCrossProductMatrix3(Eigen::MatrixBase<Derived> const &vec) {
42  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
43  using Scalar = typename Derived::Scalar;
44  using MatrixType = Eigen::Matrix<Scalar, 3, 3>;
45  MatrixType ret;
46  ret << Scalar(0), -(vec[2]), vec[1], // row 0
47  vec[2], Scalar(0), -(vec[0]), // row 1
48  -(vec[1]), vec[0], Scalar(0); // row 2
49  return ret;
50  }
51 
52 } // namespace vbtracker
53 } // namespace osvr
54 
55 #endif // INCLUDED_CrossProductMatrix_h_GUID_CFE0AD3E_5291_4282_A691_5FA4F93A4878
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header wrapping include of <Eigen/Core> and <Eigen/Geometry> for warning quieting.
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48