summaryrefslogtreecommitdiff
path: root/include/common/geom.h
blob: a843c76fcd0028716f784d09a1125b9f439ee435 (plain)
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
#ifndef UPEM_MORPHING_GEOM
#define UPEM_MORPHING_GEOM

/**
 * File: geom.h
 */

#include <stdbool.h>
#include <inttypes.h>

/**
 * Type: IntVector
 * An abstract 1-D vector.
 */
typedef int32_t IntVector;

/**
 * Struct: CartesianVector
 * An abstract 2-D vector in cartesian coordinates.
 *
 * Fields:
 *   x - the horizontal component
 *   y - the vertical component
 */
typedef struct {
  IntVector x, y;
} CartesianVector;

/**
 * Struct: CartesianMapping
 * A tuple of cartesian vectors representing a mapping.
 *
 * Fields:
 *   origin - preimage vector
 *   target - image vector
 */
typedef struct {
  CartesianVector origin, target;
} CartesianMapping;

/**
 * Function: vector_equals
 * Compares two cartesian vectors.
 *
 * Parameters:
 *   v1 - the first vector
 *   v2 - the second vector
 *
 * Returns:
 *   T(v1 is equal to v2)
 */
bool vector_equals(CartesianVector v1, CartesianVector v2);

#endif