diff options
author | XANTRONIX Development | 2022-03-05 20:32:19 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-03-05 20:32:19 -0500 |
commit | 769f1c6c4087d53a2b400511baac77b510f16798 (patch) | |
tree | 2ebd85370fa0bb1863cae63e36c3de65023c316d | |
parent | 2b14e640c78ae0136d66653cc7ed3233464b44d4 (diff) | |
download | xas-769f1c6c4087d53a2b400511baac77b510f16798.tar.gz xas-769f1c6c4087d53a2b400511baac77b510f16798.tar.bz2 xas-769f1c6c4087d53a2b400511baac77b510f16798.zip |
Implement move() in src/spatial.c
Implement move() in src/spatial.c to translate a point in 3D space along
a heading
-rw-r--r-- | src/spatial.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/spatial.c b/src/spatial.c index 06c9a22..4d52738 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -68,6 +68,21 @@ static void rotate(xas_spatial_coord rotation, point->z = Yz; } +static void move(xas_spatial_coord *point, + xas_spatial_coord heading, + float speed, + float interval) { + float distance = speed * interval; + + xas_spatial_coord normal = { 0.0f, 0.0f, distance }; + + rotate(heading, &normal); + + point->x += normal.x; + point->y += normal.y; + point->z += normal.z; +} + static int within_cone(xas_spatial_coord point, xas_spatial_cone cone) { xas_spatial_coord apex_to_point_vect, |