Updated Code + Struktogramm
This commit is contained in:
parent
e93ec34e1d
commit
e58b43e0af
Binary file not shown.
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
|
@ -51,18 +51,19 @@ public class _1_GeoAnimation_DrawingOperations extends JPanel{
|
|||
// DRAWING OPERATIONS IN HERE
|
||||
@Override protected void paintComponent(Graphics g) {
|
||||
|
||||
// Zeit-Korrektur
|
||||
time = t.GetTimeInSeconds();
|
||||
if (firstPoint) {
|
||||
deltaTime = time;
|
||||
firstPoint = false;
|
||||
}
|
||||
actualTime = time - deltaTime;
|
||||
// // Zeit-Korrektur
|
||||
// time = t.GetTimeInSeconds();
|
||||
// if (firstPoint) {
|
||||
// deltaTime = time;
|
||||
// firstPoint = false;
|
||||
// }
|
||||
// actualTime = time - deltaTime;
|
||||
|
||||
super.paintComponent(g);
|
||||
Graphics2D g2d;
|
||||
g2d = (Graphics2D) g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
|
||||
// Drawing Background
|
||||
g2d.setColor(Color.BLACK);
|
||||
|
@ -96,21 +97,21 @@ public class _1_GeoAnimation_DrawingOperations extends JPanel{
|
|||
// Drawing The Globus
|
||||
double[][] erdkreis = new double[4][1];
|
||||
erdkreis[3][0] = 1;
|
||||
for(int winkelEins = 0; winkelEins < 360 ; winkelEins += 15) {
|
||||
for(double winkelZwei = 0; winkelZwei < 360 ; winkelZwei +=0.25) {
|
||||
// Längengrad
|
||||
erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelZwei) ) * Math.cos( Math.toRadians(winkelEins) );
|
||||
erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelZwei) ) * Math.sin( Math.toRadians(winkelEins) );
|
||||
erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelZwei) );
|
||||
for(int winkelAbstand = 0; winkelAbstand < 360 ; winkelAbstand += 15) {
|
||||
for(double winkelAuszeichnen = 0; winkelAuszeichnen < 360 ; winkelAuszeichnen +=0.25) {
|
||||
// Längenkreis
|
||||
erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelAuszeichnen) ) * Math.cos( Math.toRadians(winkelAbstand) );
|
||||
erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelAuszeichnen) ) * Math.sin( Math.toRadians(winkelAbstand) );
|
||||
erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelAuszeichnen) );
|
||||
if( Meth.istHinten(erdkreis) )
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
else
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.drawLine(Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"), Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"));
|
||||
// Breitengrad
|
||||
erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelEins) ) * Math.cos( Math.toRadians(winkelZwei) );
|
||||
erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelEins) ) * Math.sin( Math.toRadians(winkelZwei) );
|
||||
erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelEins) ) ;
|
||||
// Breitenkreis
|
||||
erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelAbstand) ) * Math.cos( Math.toRadians(winkelAuszeichnen) );
|
||||
erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelAbstand) ) * Math.sin( Math.toRadians(winkelAuszeichnen) );
|
||||
erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelAbstand) ) ;
|
||||
if( Meth.istHinten(erdkreis) )
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
else
|
||||
|
@ -145,6 +146,14 @@ public class _1_GeoAnimation_DrawingOperations extends JPanel{
|
|||
System.out.println("actual time: " + (actualTime) );
|
||||
System.out.println("finish time: " + Meth.zeitGrenze() );
|
||||
|
||||
// Zeit-Korrektur
|
||||
time = t.GetTimeInSeconds();
|
||||
if (firstPoint) {
|
||||
deltaTime = time;
|
||||
firstPoint = false;
|
||||
}
|
||||
actualTime = time - deltaTime;
|
||||
|
||||
// Wegpunkt & Streckenverlauf Zeichnen
|
||||
g2d.setColor(Color.CYAN);
|
||||
bewegung = Meth.drehBewegung(Math.toRadians(actualTime));
|
||||
|
|
|
@ -55,9 +55,9 @@ public class _2_Methods {
|
|||
for(int i = 0; i < 3; i++)
|
||||
n_dach[i][0] /= betrag(n_dach);
|
||||
// Trennlinie U_Dach
|
||||
double[][] u_dach = kreuzprodukt(n_dach, p_dach);
|
||||
double[][] v_dach = kreuzprodukt(n_dach, p_dach);
|
||||
for(int i = 0; i < 3; i++)
|
||||
u_dach[i][0] /= betrag(u_dach);
|
||||
v_dach[i][0] /= betrag(v_dach);
|
||||
// Trennlinie Check NaN
|
||||
if( Double.isNaN((p_dach[0][0])) || Double.isNaN((p_dach[1][0])) || Double.isNaN((p_dach[2][0])) || Double.isNaN((n_dach[0][0])) || Double.isNaN((n_dach[1][0])) || Double.isNaN((n_dach[2][0])) ) {
|
||||
startpunkt = _0_Matrices.START(_0_Constants.PHI_S+0.01,_0_Constants.THETA_S);
|
||||
|
@ -65,9 +65,9 @@ public class _2_Methods {
|
|||
}
|
||||
// Trennlinie Ergebnismatrix
|
||||
return new double[][] {
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[0][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * u_dach[0][0] ) },
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[1][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * u_dach[1][0] ) },
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[2][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * u_dach[2][0] ) },
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[0][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * v_dach[0][0] ) },
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[1][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * v_dach[1][0] ) },
|
||||
{ ( _0_Constants.RADIUS * Math.cos(_time * _0_Constants.VELOCITY) * p_dach[2][0] ) + ( _0_Constants.RADIUS * Math.sin(_time * _0_Constants.VELOCITY) * v_dach[2][0] ) },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue