RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
dist_based_fi.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
3  * 2020 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
22 #include <math.h>
23 
24 #include "matrix.h"
25 
26 matrix_t dist_based_fi(matrix_t point[3], matrix_t ref_point[3], matrix_t ri)
27 {
28 
29  matrix_t f_i =
30  sqrt(
31  (point[0] - ref_point[0])
32  * (point[0]
33  - ref_point[0])
34  +
35  (point[1] - ref_point[1])
36  * (point[1]
37  - ref_point[1])
38  +
39  (point[2] - ref_point[2])
40  * (point[2]
41  - ref_point[2])
42  ) - ri;
43 
44  return f_i;
45 }
46 
47 void dist_based_f_i(uint8_t ref_points_num,
48  matrix_t ref_point_mat[ref_points_num][3],
49  matrix_t point[3],
50  matrix_t d_vec[], matrix_t f_vec[])
51 {
52  uint8_t i;
53 
54  for (i = 0; i < ref_points_num; i++) {
55  f_vec[i] =
56  sqrt(
57  (point[0] - ref_point_mat[i][0])
58  * (point[0]
59  - ref_point_mat[i][0])
60  +
61  (point[1]
62  - ref_point_mat[i][1])
63  * (point[1]
64  - ref_point_mat[i][1])
65  +
66  (point[2]
67  - ref_point_mat[i][2])
68  * (point[2]
69  - ref_point_mat[i][2])
70  )
71  - d_vec[i];
72  }
73 }
dist_based_f_i
void dist_based_f_i(uint8_t ref_points_num, matrix_t ref_point_mat[ref_points_num][3], matrix_t point[3], matrix_t d_vec[], matrix_t f_vec[])
Defines the error function of a distance-based localization system.
Definition: dist_based_fi.c:47
matrix.h
Matrix computations.
matrix_t
#define matrix_t
Define the data type of the matrix elements.
Definition: matrix.h:38
dist_based_fi
matrix_t dist_based_fi(matrix_t point[3], matrix_t ref_point[3], matrix_t ri)
Defines the error function of a distance-based localization system.
Definition: dist_based_fi.c:26