Skip to content

Instantly share code, notes, and snippets.

@gusennan
Last active November 27, 2015 16:47
Show Gist options
  • Save gusennan/c98dfb664effce04d77d to your computer and use it in GitHub Desktop.
Save gusennan/c98dfb664effce04d77d to your computer and use it in GitHub Desktop.
(1a)
//takes in two "points" (arrays of doubles), and returns an array of doubles that contains
//the slope and the y intercept of the line between the two points
double * line(double * pt1, double * pt2){
double xTmp, yTmp;
xTmp = (pt2[1]-pt1[1])/(pt2[0]-pt1[0]);
yTmp = pt1[1] - xTmp*pt1[0];
pt1[0] = xTmp;
pt1[1] = yTmp;
return pt1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment