A5/GeometryUtils.h

38 lines
1.3 KiB
C
Raw Normal View History

2024-11-06 17:02:59 -07:00
#ifndef GEOMETRY_UTILS_H
#define GEOMETRY_UTILS_H
#include "Coordinate.h"
#include <limits>
/**
* @brief Compares two doubles to see if they are equal, within the system epsilon range
*
* @param first The first value to compare
* @param second The second value to compare
* @return true The values are equal
* @return false The values are not equal
*/
bool double_eq(double first, double second);
/**
* @brief Calculates the distance between two coordinate points
*
* @param firstPoint The first coordinate point to calculate the distance of
* @param secondPoint The second coordinate point to compare the first to
* @return double The pythagorean distance between the two points
*/
double calculate_distance(Coordinate& firstPoint, Coordinate& secondPoint);
/**
* @brief Returns true if all of the side lengths in the specified array make a triangle
*
* @param sideOne The first side to check for "triangle-ness"
* @param sideTwo The second side to check for "triangle-ness"
* @param sideThree The third side to check for "triangle-ness"
*
* @return true The side lengths do make a geometrically sound triangle
* @return false The side lengths do not make a geometrically sound triangle
*/
bool lengths_make_triangle(double sideOne, double sideTwo, double sideThree);
#endif // GEOMETRY_UTILS_H