1 /* 2 * Copyright (C) 2005-2020 Team Kodi (https://kodi.tv) 3 * Copyright (C) 2012 Marcel Ebmer 4 * 5 * SPDX-License-Identifier: GPL-2.0-or-later 6 * See LICENSE.md for more information. 7 */ 8 9 #ifndef F_VECTOR_H 10 #define F_VECTOR_H 11 12 #include <math.h> 13 #include <stdint.h> 14 15 struct _fische__vector_ { 16 double x; 17 double y; 18 }; 19 20 typedef struct _fische__vector_ fische__vector; 21 typedef struct _fische__vector_ fische__point; 22 23 enum {_FISCHE__VECTOR_LEFT_, _FISCHE__VECTOR_RIGHT_}; 24 25 double fische__vector_length (fische__vector* self); 26 fische__vector fische__vector_normal (fische__vector* self); 27 fische__vector fische__vector_single (fische__vector* self); 28 double fische__vector_angle (fische__vector* self); 29 uint16_t fische__vector_to_uint16 (fische__vector* self); 30 fische__vector fische__vector_from_uint16 (uint16_t val); 31 void fische__vector_add (fische__vector* self, fische__vector* other); 32 void fische__vector_sub (fische__vector* self, fische__vector* other); 33 void fische__vector_mul (fische__vector* self, double val); 34 void fische__vector_div (fische__vector* self, double val); 35 36 fische__vector fische__vector_intersect_border (fische__vector* self, 37 fische__vector* normal_vec, 38 uint_fast16_t width, 39 uint_fast16_t height, 40 int_fast8_t direction); 41 42 #endif 43