| 1 | /* |
| 2 | * Copyright 2016-2017 Uber Technologies, Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | /** @file vec2d.h |
| 17 | * @brief 2D floating point vector functions. |
| 18 | */ |
| 19 | |
| 20 | #ifndef VEC2D_H |
| 21 | #define VEC2D_H |
| 22 | |
| 23 | #include <stdbool.h> |
| 24 | |
| 25 | /** @struct Vec2d |
| 26 | * @brief 2D floating-point vector |
| 27 | */ |
| 28 | typedef struct { |
| 29 | double x; ///< x component |
| 30 | double y; ///< y component |
| 31 | } Vec2d; |
| 32 | |
| 33 | // Internal functions |
| 34 | |
| 35 | double _v2dMag(const Vec2d* v); |
| 36 | void _v2dIntersect(const Vec2d* p0, const Vec2d* p1, const Vec2d* p2, |
| 37 | const Vec2d* p3, Vec2d* inter); |
| 38 | bool _v2dEquals(const Vec2d* p0, const Vec2d* p1); |
| 39 | |
| 40 | #endif |
| 41 | |