Retta
This commit is contained in:
parent
e333912462
commit
e7a0bba79b
BIN
src/Retta.class
Normal file
BIN
src/Retta.class
Normal file
Binary file not shown.
20
src/Retta.java
Normal file
20
src/Retta.java
Normal file
@ -0,0 +1,20 @@
|
||||
import java.awt.Point;
|
||||
|
||||
public class Retta{
|
||||
public static void main(String [] args){
|
||||
Point p1 = new Point(0, 3);
|
||||
Point p2 = new Point(2, 4);
|
||||
int x = 4;
|
||||
|
||||
System.out.println(x*getM(p1, p2) + getQ(p1, p2));
|
||||
|
||||
}
|
||||
|
||||
public static double getM(Point a, Point b){
|
||||
return (b.getY()-a.getY())/(b.getX()-a.getX());
|
||||
}
|
||||
|
||||
public static double getQ(Point a, Point b){
|
||||
return a.getY()-a.getX()*getM(a, b);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user