Skip to content

Instantly share code, notes, and snippets.

@benajaero
Last active July 28, 2017 01:16
Show Gist options
  • Save benajaero/5a029bc0a0347c29338b8498add88dae to your computer and use it in GitHub Desktop.
Save benajaero/5a029bc0a0347c29338b8498add88dae to your computer and use it in GitHub Desktop.
A little library I made for my maths homework because I'm lazy
#include <cmath>
#include <iostream>
struct Point {
double x;
double y;
};
double distLength(struct Point point1,struct Point point2) {
double xlength = point1.x - point2.x, ylength = point1.y - point2.y;
return std::sqrt(xlength * xlength + ylength * ylength);
}
struct Point midpoint(struct Point point1, struct Point point2) {
struct Point point;
point.x = (point1.x + point2.x) / 2;
point.y = (point1.y + point2.y) / 2;
return point;
}
int main(void) {
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment