iCub-main
math.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms
7  * of the BSD-3-Clause license. See the accompanying LICENSE file for
8  * details.
9 */
10 
37 #ifndef __CTRLMATH_H__
38 #define __CTRLMATH_H__
39 
40 #include <cmath>
41 
42 #include <yarp/sig/Vector.h>
43 #include <yarp/sig/Matrix.h>
44 #include <yarp/math/Math.h>
45 
46 
47 namespace iCub
48 {
49 
50 namespace ctrl
51 {
52 
56 constexpr double CTRL_PI = M_PI;
57 
61 constexpr double CTRL_RAD2DEG = 180.0 / M_PI;
62 
66 constexpr double CTRL_DEG2RAD = M_PI / 180.0;
67 
79 double dot(const yarp::sig::Matrix &A, int colA,
80  const yarp::sig::Matrix &B, int colB);
81 
91 inline double norm2(const yarp::sig::Matrix &M, int col)
92 {
93  return dot(M,col,M,col);
94 }
95 
105 double norm(const yarp::sig::Matrix &M, int col);
106 
118 yarp::sig::Vector cross(const yarp::sig::Matrix &A, int colA,
119  const yarp::sig::Matrix &B, int colB);
120 
131 yarp::sig::Vector Dcross(const yarp::sig::Vector &a, const yarp::sig::Vector &Da,
132  const yarp::sig::Vector &b, const yarp::sig::Vector &Db);
133 
147 yarp::sig::Vector Dcross(const yarp::sig::Matrix &A, const yarp::sig::Matrix &DA, int colA,
148  const yarp::sig::Matrix &B, const yarp::sig::Matrix &DB, int colB);
149 
150 }
151 
152 }
153 
154 #endif
155 
156 
157 
#define M_PI
Definition: XSensMTx.cpp:24
double dot(const yarp::sig::Matrix &A, int colA, const yarp::sig::Matrix &B, int colB)
Returns the dot product between two vectors given in the form: matrix(:,col).
double norm2(const yarp::sig::Matrix &M, int col)
Returns the squared norm of the vector given in the form: matrix(:,col).
Definition: math.h:91
double norm(const yarp::sig::Matrix &M, int col)
Returns the norm of the vector given in the form: matrix(:,col).
yarp::sig::Vector Dcross(const yarp::sig::Vector &a, const yarp::sig::Vector &Da, const yarp::sig::Vector &b, const yarp::sig::Vector &Db)
Returns the derivatice of cross product between two vectors.
yarp::sig::Vector cross(const yarp::sig::Matrix &A, int colA, const yarp::sig::Matrix &B, int colB)
Returns the cross product between two vectors given in the form: matrix(:,col).
constexpr double CTRL_PI
The PI constant.
Definition: math.h:56
constexpr double CTRL_RAD2DEG
180/PI.
Definition: math.h:61
constexpr double CTRL_DEG2RAD
PI/180.
Definition: math.h:66
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
A
Definition: sine.m:16