Debian Codegraph @

converter/other/pamtosvg/vector.h

raw
1 /* vector.h: operations on vectors and points. */
2
3 #ifndef VECTOR_H
4 #define VECTOR_H
5
6 #include "point.h"
7 #include "exception.h"
8
9 /* Our vectors are represented as displacements along the x and y axes. */
10
11 typedef struct
12 {
13 float dx, dy, dz;
14 } Vector;
15
16
17 Vector
18 vector_fromPoint(Point const c);
19
20 Vector
21 vector_fromTwoPoints(Point const c1,
22 Point const c2);
23
24 Point
25 vector_toPoint_point(Vector const v);
26
27
28 /* Definitions for these common operations can be found in any decent
29 linear algebra book, and most calculus books.
30 */
31
32 float
33 vector_magnitude(Vector const v);
34
35 Vector
36 vector_normalized(Vector const v);
37
38 Vector
39 vector_sum(Vector const addend,
40 Vector const adder);
41
42 float
43 vector_dotProduct(Vector const v1,
44 Vector const v2);
45
46 Vector
47 vector_scaled(Vector const v,
48 float const r);
49
50 float
51 vector_angle(Vector const inVector,
52 Vector const outVector,
53 at_exception_type * const exP);
54
55 Point
56 vector_sumPoint(Point const c,
57 Vector const v);
58
59 Point
60 vector_diffPoint(Point const c,
61 Vector const v);
62
63 pm_pixelcoord
64 vector_sumIntPoint(pm_pixelcoord const c,
65 Vector const v);
66
67 Vector
68 vector_abs(Vector const v);
69
70 Vector
71 vector_pointDirection(Point const final,
72 Point const initial);
73
74
75 Vector
76 vector_IPointDiff(pm_pixelcoord const coord1,
77 pm_pixelcoord const coord2);
78
79 Vector
80 vector_horizontal(void);
81
82 Vector
83 vector_zero(void);
84
85 bool
86 vector_equal(Vector const comparand,
87 Vector const comparator);
88
89 #endif