about summary refs log tree commit diff
path: root/converter/other/pamtosvg/vector.h
blob: 65364c82c5565dbc222216e3deaff80573ac0e2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* vector.h: operations on vectors and points. */

#ifndef VECTOR_H
#define VECTOR_H

#include "point.h"
#include "exception.h"

/* Our vectors are represented as displacements along the x and y axes.  */

typedef struct
{
  float dx, dy, dz;
} Vector;


Vector
vector_fromPoint(Point const c);

Vector
vector_fromTwoPoints(Point const c1,
                     Point const c2);

Point
vector_toPoint_point(Vector const v);


/* Definitions for these common operations can be found in any decent
   linear algebra book, and most calculus books.
*/

float
vector_magnitude(Vector const v);

Vector
vector_normalized(Vector const v);

Vector
vector_sum(Vector const addend,
           Vector const adder);

float
vector_dotProduct(Vector const v1,
                  Vector const v2);

Vector
vector_scaled(Vector const v,
              float  const r);

float
vector_angle(Vector              const inVector,
             Vector              const outVector,
             at_exception_type * const exP);

Point
vector_sumPoint(Point  const c,
                Vector const v);

Point
vector_diffPoint(Point  const c,
                 Vector const v);

pm_pixelcoord
vector_sumIntPoint(pm_pixelcoord const c,
                   Vector        const v);

Vector
vector_abs(Vector const v);

Vector
vector_pointDirection(Point const final,
                      Point const initial);


Vector
vector_IPointDiff(pm_pixelcoord const coord1,
                  pm_pixelcoord const coord2);

Vector
vector_horizontal(void);

Vector
vector_zero(void);

bool
vector_equal(Vector const comparand,
             Vector const comparator);

#endif