summaryrefslogtreecommitdiff
path: root/include/common/geom.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/common/geom.h')
-rw-r--r--include/common/geom.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/include/common/geom.h b/include/common/geom.h
index a843c76..b3564a5 100644
--- a/include/common/geom.h
+++ b/include/common/geom.h
@@ -38,6 +38,46 @@ typedef struct {
38 CartesianVector origin, target; 38 CartesianVector origin, target;
39} CartesianMapping; 39} CartesianMapping;
40 40
41
42/**
43 * Function: m
44 * Shorthand for an identity mapping.
45 *
46 * Parameters:
47 * x - the x-coordinate
48 * y - the y-coordinate
49 *
50 * Returns:
51 * A cartesian identity mapping
52 */
53CartesianMapping m(int x, int y);
54
55/**
56 * Function: v
57 * Shorthand for a vector.
58 *
59 * Parameters:
60 * x - the x-coordinate
61 * y - the y-coordinate
62 *
63 * Returns:
64 * An integer vector
65 */
66CartesianVector v(int x, int y);
67
68/**
69 * Function: mappings_equals
70 * Compares two cartesian mappings.
71 *
72 * Parameters:
73 * m1 - the first mapping
74 * m2 - the second mapping
75 *
76 * Returns:
77 * T(m1 is equal to m2)
78 */
79bool mappings_equals(CartesianMapping m1, CartesianMapping m2);
80
41/** 81/**
42 * Function: vector_equals 82 * Function: vector_equals
43 * Compares two cartesian vectors. 83 * Compares two cartesian vectors.
@@ -51,4 +91,18 @@ typedef struct {
51 */ 91 */
52bool vector_equals(CartesianVector v1, CartesianVector v2); 92bool vector_equals(CartesianVector v1, CartesianVector v2);
53 93
94/**
95 * Function: triangle_area
96 * Computes the area of a triangle.
97 *
98 * Parameters:
99 * v1 - first vertex
100 * v2 - second vertex
101 * v3 - third vertex
102 *
103 * Returns:
104 * The area of the triangle spawned by the three supplied vertices
105 */
106IntVector triangle_area(CartesianVector v1, CartesianVector v2, CartesianVector v3);
107
54#endif 108#endif