Hallo,
ich habe keine Ahnung, wie ich überprüfen kann ob ein Punkt im oder außerhalb des Rechtecks ist.
Wie mache ich das?
ich habe keine Ahnung, wie ich überprüfen kann ob ein Punkt im oder außerhalb des Rechtecks ist.
Wie mache ich das?
Java:
public class Rect {
private double m1,m2,b,h,breiteHoehe;
public Rect(double m1, double m2){
this.m1=m1;
this.m2=m2;
}
public Rect(double m1,double m2,double b, double h){
this(m1,m2); // Warum nicht this.m1, this.m2
this.b=b;
this.h=h;
}
public Rect(double m1,double m2, double breiteHoehe){
this(m1,m2);
this.breiteHoehe=breiteHoehe;
}
public double area(){
return this.b*this.h;
}
public double circumference(){
return 2*b+2*h;
}
public void move(double x, double y){
this.b+=x;
this.h+=y;
}
public void scale (double faktor){
this.b*=faktor;
this.h*=faktor;
}
public boolean contains(Point p){ // Warum kein new Point...
return false;
}
}