added position + ball
This commit is contained in:
parent
0c5e46fbf2
commit
57938354ef
|
|
@ -0,0 +1,20 @@
|
||||||
|
package fußballmanager;
|
||||||
|
|
||||||
|
public class Flugbahn {
|
||||||
|
//Steigung m
|
||||||
|
//Y-Achsen abschnitt b
|
||||||
|
//Definitionsbereich x1 und x2 + y1 und y2
|
||||||
|
|
||||||
|
double m,b;
|
||||||
|
//double x1,x2,y1,y2;
|
||||||
|
|
||||||
|
public Flugbahn(Position p1,Position p2) {
|
||||||
|
m = (p1.y-p2.y)/(p1.x-p2.x);
|
||||||
|
b = p1.y+m*p1.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Moritz mach das mal :D
|
||||||
|
public double getDistancToPosition(Position p){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package fußballmanager;
|
||||||
|
|
||||||
|
public class Position {
|
||||||
|
|
||||||
|
double x,y;
|
||||||
|
|
||||||
|
public Position(double x,double y){
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Berechnung der Distanz zwischen zwei Punkten/Positionen mittels Satz des Pytagoras
|
||||||
|
public double getDistance(Position p){
|
||||||
|
double a,b;
|
||||||
|
a = Math.abs(x-p.x);
|
||||||
|
b = Math.abs(y-p.y);
|
||||||
|
return Math.sqrt(a*a+b*b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package fußballmanager.personen;
|
||||||
|
|
||||||
|
import fußballmanager.Position;
|
||||||
|
|
||||||
|
public class Ball{
|
||||||
|
Position p;
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
package fußballmanager.personen;
|
package fußballmanager.personen;
|
||||||
|
|
||||||
|
import fußballmanager.Position;
|
||||||
import fußballmanager.Team;
|
import fußballmanager.Team;
|
||||||
|
|
||||||
public abstract class Person {
|
public abstract class Person {
|
||||||
int alter;
|
int alter;
|
||||||
Team team;
|
Team team;
|
||||||
String name,vorname;
|
String name,vorname;
|
||||||
|
Position p;
|
||||||
|
|
||||||
public void setTeam(Team team){
|
public void setTeam(Team team){
|
||||||
this.team = team;
|
this.team = team;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue