File: points.in

package info (click to toggle)
mathomatic 16.0.5-5.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,192 kB
  • sloc: ansic: 22,029; makefile: 340; sh: 319; python: 96; awk: 39
file content (14 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

; This is the equation for a straight line given 2 points on the line.
; Point 1 is (x1, y1) and point 2 is (x2, y2) on a 2D Cartesian plane.

y = ((y2*x1)+(x*(y1-y2))-(y1*x2))/(x1-x2)

; This is the equation for a quadratic curve given 3 points on it.
; It is derived in the file "poly.in" (y = a + b*x + c*x^2).
; Point 1 is (x1, y1), point 2 is (x2, y2), and point 3 is (x3, y3).

y = ((y2*((x3*x1)+(x^2))*(x3-x1))+(x*(((x1^2)*(y2-y3))+((x3^2)*(y1-y2))))+(y1*((x2*((x^2)-(x3^2)))-((x^2)*x3)))+((x2^2)*((x*(y3-y1))+(x3*y1)))-(y3*((x^2)+(x1*x2))*(x2-x1)))/(x3-x1)/(x2-x1)/(x2-x3)

; Type in "calc" to plug in values.
; Just hit Enter when prompted for "x".