Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * pf_vector.h: Vector functions 00004 * 00005 * Created: Thu May 24 18:41:48 2012 00006 * Copyright 2000 Brian Gerkey 00007 * 2000 Kasper Stoy 00008 * 2012 Tim Niemueller [www.niemueller.de] 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL file in the doc directory. 00022 */ 00023 00024 /* From: 00025 * Player - One Hell of a Robot Server (LGPL) 00026 * Copyright (C) 2000 Brian Gerkey & Kasper Stoy 00027 * gerkey@usc.edu kaspers@robotics.usc.edu 00028 */ 00029 /************************************************************************** 00030 * Desc: Vector functions 00031 * Author: Andrew Howard 00032 * Date: 10 Dec 2002 00033 *************************************************************************/ 00034 00035 #ifndef PF_VECTOR_H 00036 #define PF_VECTOR_H 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 #include <stdio.h> 00043 00044 /// @cond EXTERNAL 00045 00046 // The basic vector 00047 typedef struct 00048 { 00049 double v[3]; 00050 } pf_vector_t; 00051 00052 00053 // The basic matrix 00054 typedef struct 00055 { 00056 double m[3][3]; 00057 } pf_matrix_t; 00058 00059 00060 // Return a zero vector 00061 pf_vector_t pf_vector_zero(); 00062 00063 // Check for NAN or INF in any component 00064 int pf_vector_finite(pf_vector_t a); 00065 00066 // Print a vector 00067 void pf_vector_fprintf(pf_vector_t s, FILE *file, const char *fmt); 00068 00069 // Simple vector addition 00070 pf_vector_t pf_vector_add(pf_vector_t a, pf_vector_t b); 00071 00072 // Simple vector subtraction 00073 pf_vector_t pf_vector_sub(pf_vector_t a, pf_vector_t b); 00074 00075 // Transform from local to global coords (a + b) 00076 pf_vector_t pf_vector_coord_add(pf_vector_t a, pf_vector_t b); 00077 00078 // Transform from global to local coords (a - b) 00079 pf_vector_t pf_vector_coord_sub(pf_vector_t a, pf_vector_t b); 00080 00081 00082 // Return a zero matrix 00083 pf_matrix_t pf_matrix_zero(); 00084 00085 // Check for NAN or INF in any component 00086 int pf_matrix_finite(pf_matrix_t a); 00087 00088 // Print a matrix 00089 void pf_matrix_fprintf(pf_matrix_t s, FILE *file, const char *fmt); 00090 00091 // Compute the matrix inverse. Will also return the determinant, 00092 // which should be checked for underflow (indicated singular matrix). 00093 //pf_matrix_t pf_matrix_inverse(pf_matrix_t a, double *det); 00094 00095 // Decompose a covariance matrix [a] into a rotation matrix [r] and a 00096 // diagonal matrix [d] such that a = r * d * r^T. 00097 void pf_matrix_unitary(pf_matrix_t *r, pf_matrix_t *d, pf_matrix_t a); 00098 00099 /// @endcond 00100 00101 #ifdef __cplusplus 00102 } 00103 #endif 00104 00105 #endif