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 
iCub
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Definition: emotionInterface.h:17
iCub::ctrl::CTRL_DEG2RAD
constexpr double CTRL_DEG2RAD
PI/180.
Definition: math.h:66
iCub::ctrl::dot
double dot(const yarp::sig::Matrix &A, int colA, const yarp::sig::Matrix &B, int colB)
iCub::ctrl::norm2
double norm2(const yarp::sig::Matrix &M, int col)
Definition: math.h:91
iCub::ctrl::norm
double norm(const yarp::sig::Matrix &M, int col)
iCub::ctrl::CTRL_PI
constexpr double CTRL_PI
The PI constant.
Definition: math.h:56
iCub::ctrl::cross
yarp::sig::Vector cross(const yarp::sig::Matrix &A, int colA, const yarp::sig::Matrix &B, int colB)
A
A
Definition: sine.m:16
iCub::ctrl::Dcross
yarp::sig::Vector Dcross(const yarp::sig::Vector &a, const yarp::sig::Vector &Da, const yarp::sig::Vector &b, const yarp::sig::Vector &Db)
M_PI
#define M_PI
Definition: XSensMTx.cpp:24
iCub::ctrl::CTRL_RAD2DEG
constexpr double CTRL_RAD2DEG
180/PI.
Definition: math.h:61