From 67246b5142442af819f0285ad7d60b52e966e010 Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 14 Apr 2020 05:55:46 -0500 Subject: new function: c2_add. you can guess what it does. --- src/math.c | 5 +++++ src/math.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/math.c b/src/math.c index 6a077f0..9f7e0cc 100644 --- a/src/math.c +++ b/src/math.c @@ -193,6 +193,11 @@ c3_t c3_add(c3_t p1,c3_t p2) { return (c3_t){p1.x+p2.x,p1.y+p2.y,p1.z+p2.z}; } +//this could probably be a macro, or inline or whatever. and also work for cs_t +c2_t c2_add(c2_t p1,c2_t p2) { + return (c2_t){p1.x+p2.x,p1.y+p2.y}; +} + real distance3(c3_t p1,c3_t p2) { return sqrt(( (p1.x-p2.x)*(p1.x-p2.x) )+( (p1.y-p2.y)*(p1.y-p2.y) )+( (p1.z-p2.z)*(p1.z-p2.z) )); } diff --git a/src/math.h b/src/math.h index e7b5249..b333767 100644 --- a/src/math.h +++ b/src/math.h @@ -21,6 +21,7 @@ radians points_to_angle(c2_t p1,c2_t p2); int between_angles(degrees d,real lower,real upper); c3_s_t apply_group_relative(c3_s_t s,c3_group_rot_t *group_rot); c3_t c3_add(c3_t p1,c3_t p2); +c2_t c2_add(c2_t p1,c2_t p2); real distance3(c3_t p1,c3_t p2); void print_point(c3_t p); -- cgit v1.2.3