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 <yarp/sig/Vector.h>
41 #include <yarp/sig/Matrix.h>
42 #include <yarp/math/Math.h>
43 
44 
45 namespace iCub
46 {
47 
48 namespace ctrl
49 {
50 
54 extern const double CTRL_PI;
55 
59 extern const double CTRL_RAD2DEG;
60 
64 extern const double CTRL_DEG2RAD;
65 
77 double dot(const yarp::sig::Matrix &A, int colA,
78  const yarp::sig::Matrix &B, int colB);
79 
89 inline double norm2(const yarp::sig::Matrix &M, int col)
90 {
91  return dot(M,col,M,col);
92 }
93 
103 double norm(const yarp::sig::Matrix &M, int col);
104 
116 yarp::sig::Vector cross(const yarp::sig::Matrix &A, int colA,
117  const yarp::sig::Matrix &B, int colB);
118 
129 yarp::sig::Vector Dcross(const yarp::sig::Vector &a, const yarp::sig::Vector &Da,
130  const yarp::sig::Vector &b, const yarp::sig::Vector &Db);
131 
145 yarp::sig::Vector Dcross(const yarp::sig::Matrix &A, const yarp::sig::Matrix &DA, int colA,
146  const yarp::sig::Matrix &B, const yarp::sig::Matrix &DB, int colB);
147 
148 }
149 
150 }
151 
152 #endif
153 
154 
155 
const double CTRL_PI
The PI constant.
Definition: math.cpp:27
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:89
double norm(const yarp::sig::Matrix &M, int col)
Returns the norm of the vector given in the form: matrix(:,col).
A
Definition: sine.m:16
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).
const double CTRL_RAD2DEG
180/PI.
Definition: math.cpp:28
const double CTRL_DEG2RAD
PI/180.
Definition: math.cpp:29
This file contains the definition of unique IDs for the body parts and the skin parts of the robot...
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.