liba2ri  0.2
 All Data Structures
vector.h
1 /*************************************/
2 /* Auteur : Rémi Synave */
3 /* Date de création : 01/03/07 */
4 /* Date de modification : 08/01/10 */
5 /* Version : 0.2 */
6 /*************************************/
7 
8 /***************************************************************************/
9 /* This file is part of a2ri. */
10 /* */
11 /* a2ri is free software: you can redistribute it and/or modify it */
12 /* under the terms of the GNU Lesser General Public License as published */
13 /* by the Free Software Foundation, either version 3 of the License, or */
14 /* (at your option) any later version. */
15 /* */
16 /* a2ri is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public */
22 /* License along with a2ri. */
23 /* If not, see <http://www.gnu.org/licenses/>. */
24 /***************************************************************************/
25 
26 
27 
28 #ifndef VECTOR__H
29 #define VECTOR__H
30 
31 #include <math.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include "util.h"
35 
36 
37 typedef struct
38 {
39  double dx,
40  dy,
41  dz;
42 } vector3d;
43 
52 void vector3d_init (
53  vector3d * v,
54  double dx,
55  double dy,
56  double dz);
57 
63 void vector3d_display (
64  vector3d v);
65 
71 double vector3d_size (
72  vector3d v);
73 
80 int vector3d_equal (
81  vector3d v1,
82  vector3d v2);
83 
89 void vector3d_normalize (
90  vector3d * v);
91 
98 double vector3d_scalarproduct (
99  vector3d v1,
100  vector3d v2);
101 
108 vector3d vector3d_vectorialproduct (
109  vector3d v1,
110  vector3d v2);
111 
117 void vector3d_reverse (
118  vector3d * v);
119 
126 vector3d vector3d_add (
127  vector3d v1,
128  vector3d v2);
129 
136 vector3d vector3d_sub (
137  vector3d v1,
138  vector3d v2);
139 
147 int list_vector3d_contains (
148  vector3d * list,
149  int size,
150  vector3d tosearch);
151 
160 int list_vector3d_add (
161  vector3d ** list,
162  int *size,
163  vector3d toadd,
164  int add_type);
165 
172 void list_vector3d_display (
173  vector3d * list,
174  int size);
175 
176 #endif