* avoid and API breakage.
[hkl.git] / hkl / hkl-vector.h
blobf356d7618963a9df6b5b0c7eababc158a7663c29
1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2010 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
22 #ifndef __HKL_VECTOR_H__
23 #define __HKL_VECTOR_H__
25 #include <stdio.h>
26 #include <math.h>
27 #include <hkl/hkl-macros.h>
29 HKL_BEGIN_DECLS
31 /* forward declaration begin */
32 typedef struct _HklMatrix HklMatrix;
33 typedef struct _HklQuaternion HklQuaternion;
34 /* forward declaration end */
36 typedef struct _HklVector HklVector;
38 struct _HklVector
40 double data[3];
43 extern void hkl_vector_init(HklVector *self, double x, double y, double z);
45 extern void hkl_vector_fprintf(FILE *file, const HklVector *self);
47 extern int hkl_vector_cmp(const HklVector *self, const HklVector *vector);
49 extern int hkl_vector_is_opposite(const HklVector *self,
50 const HklVector *vector);
52 extern void hkl_vector_add_vector(HklVector *self, const HklVector *vector);
54 extern void hkl_vector_minus_vector(HklVector *self, const HklVector *vector);
56 extern void hkl_vector_div_double(HklVector *self, const double d);
58 extern void hkl_vector_times_double(HklVector *self, const double d);
60 extern void hkl_vector_times_vector(HklVector *self, const HklVector *vector);
62 extern void hkl_vector_times_matrix(HklVector *self, const HklMatrix *m);
64 extern double hkl_vector_sum(const HklVector *self);
66 extern double hkl_vector_scalar_product(const HklVector *self,
67 const HklVector *vector);
69 extern void hkl_vector_vectorial_product(HklVector *self,
70 const HklVector *vector);
72 extern double hkl_vector_angle(const HklVector *self,
73 const HklVector *vector);
75 extern double hkl_vector_oriented_angle(const HklVector *self,
76 const HklVector *vector,
77 const HklVector *ref);
79 extern double hkl_vector_oriented_angle_points(const HklVector *self,
80 const HklVector *p2,
81 const HklVector *p3,
82 const HklVector *ref);
84 extern double hkl_vector_norm2(const HklVector *self);
86 extern int hkl_vector_normalize(HklVector *self);
88 extern int hkl_vector_is_colinear(const HklVector *self,
89 const HklVector *vector);
91 extern void hkl_vector_randomize(HklVector *self);
93 extern void hkl_vector_randomize_vector(HklVector *self,
94 const HklVector *vector);
96 extern void hkl_vector_randomize_vector_vector(HklVector *self,
97 const HklVector *vector1,
98 const HklVector *vector2);
100 extern void hkl_vector_rotated_around_vector(HklVector *self,
101 const HklVector *axe,
102 double angle);
104 extern void hkl_vector_rotated_quaternion(HklVector *self,
105 const HklQuaternion *qr);
107 extern void hkl_vector_rotated_around_line(HklVector *self, double angle,
108 const HklVector *c1, const HklVector *c2);
110 extern int hkl_vector_is_null(const HklVector *self);
112 extern void hkl_vector_project_on_plan(HklVector *self,
113 const HklVector *plan);
115 extern void hkl_vector_project_on_plan_with_point(HklVector *self,
116 const HklVector *plan,
117 const HklVector *point);
119 HKL_END_DECLS
121 #endif