Code:
public class Trigonometrisch {
protected Color color;
protected double a;
protected double omega;
protected double omega0;
public Trigonometrisch(double a,double omega,double omega0,Color color){
this.color=color;
this.a=a;
this.omega=omega;
this.omega0=omega0;
}
public void draw(Graphics g){
g.setColor(color);
for(double x=-1000;x<1000;x+=0.5){
double y=a*Math.sin(omega*x+omega0);
double ymehr=a*Math.sin(omega*(x+0.5)+omega0);
g.drawLine((int)(x+200),(int)(y+500),(int)(x+0.5+200),(int)(ymehr+500));
}
}
}
also diese classe zeichnet mir schon wunderbar verschiedene sinus ähnliche funktionen
nur möchte ich jetzt mir bestimmte Punkte makieren lassen(z.B. PI/2 oder jedes PI/4) und das mit dem schon angefertigten Punkt Objekt
Code:
public class Punkt {
protected double x;
protected double y;
public Punkt(double x, double y) {
this.x = x;
this.y = y;
}
protected void setColor(Graphics g){
g.setColor(Color.RED);
}
public void draw(Graphics g) {
g.setColor(Color.BLACK);
g.drawOval((int)(x-1.5),(int)(y-1.5),3,3);
setColor(g);
g.fillOval((int)(x-1.5),(int)(y-1.5),3,3);
}
public String toString() {
return "(" + x + "," + y + ")";
}
}
mein Problem wie finde ich die Stelle PI/2 oder ähnliches??
desweiterem komm ich mit dem zeitlichen ablauf nicht klar denn die werte der funktion habe ich ja im objekt Trigon.. muss ich Punkt auch dann aufrufen oder erst spähter nach dem die funktion gezeichnet wurde un d mi also noch weitere übergabe param besorgen??
bitte erstmal etwas allgemein antworten möchte schon noch selber Programmieren
danke im vorraus
tombo