2024-11-06 17:02:59 -07:00
|
|
|
#include "IsoscelesTriangle.h"
|
2024-11-18 00:16:40 -07:00
|
|
|
|
2024-11-06 17:02:59 -07:00
|
|
|
#include "GeometryUtils.h"
|
|
|
|
|
|
|
|
bool IsoscelesTriangle::validate() {
|
2024-11-18 00:16:40 -07:00
|
|
|
double sideOne = calculate_distance(mVertices[0], mVertices[1]);
|
|
|
|
double sideTwo = calculate_distance(mVertices[1], mVertices[2]);
|
|
|
|
double sideThree = calculate_distance(mVertices[2], mVertices[0]);
|
2024-11-06 17:02:59 -07:00
|
|
|
|
2024-11-18 00:16:40 -07:00
|
|
|
// Isosceles triangles must (a) Be a triangle and (b) Have two sides that
|
|
|
|
// equal each other
|
|
|
|
return lengths_make_triangle(sideOne, sideTwo, sideThree) &&
|
|
|
|
(double_eq(sideOne, sideTwo) || double_eq(sideTwo, sideThree) ||
|
|
|
|
double_eq(sideThree, sideOne));
|
2024-11-06 17:02:59 -07:00
|
|
|
}
|