package app; public class _2_Methods { // Objektattribute double[][] startpunkt = _0_Matrices.START(_0_Constants.PHI_S,_0_Constants.THETA_S); double[][] endpunkt = _0_Matrices.END(_0_Constants.PHI_E,_0_Constants.THETA_E); // Gibt X oder Y Koordinate aus einem normierten Vektor zurück, abhängig vom String Parameter protected int getCoords(double[][] _vector, String _axe) { double[][] coordinate = matrixMultiplikation(_0_Matrices.M_JavaNormalized, _vector); if( _axe.contentEquals("x")) return (int)coordinate[0][0]; else if( _axe.contentEquals("y")) return (int)coordinate[1][0]; else return -1000; } // Führt eine Matrixmultiplikation zweier 2D-Arrays aus protected double[][] matrixMultiplikation(double[][] matrix_eins, double[][] matrix_zwei) { double[][] ergebnismatrix = new double[matrix_eins.length][matrix_zwei[0].length]; if(matrix_eins[0].length == matrix_zwei.length) for(int z=0; z 1) variable += (variable - 1); return (Math.acos( variable ) ) ; } // Berechnet die Entfernung vom Start bis zum Endpunkt als Radius protected double RadiusStartToEnd() { double variable = ( skalarprodukt (startpunkt,endpunkt) ) / ( betrag(startpunkt) * betrag(endpunkt)) ; if(variable < -1) variable -= (variable + 1); if(variable > 1) variable += (variable - 1); return Math.acos( variable ) * _0_Constants.RADIUS; } protected double zeitGrenze() { return Math.toDegrees( (WinkelstartToEnd() / (_0_Constants.VELOCITY) ) ); } // Bestimmt, ob sich das Objekt im negativen Bereich der x-Achse befindet protected boolean istHinten(double[][] _vector) { if( getPhi(_vector) < 90) return false; else if( getPhi(_vector) < 270) return true; else return false; } // Bestimmt den Winkel Phi der Umrissellipse protected double umrissPhi() { return Math.atan( _0_Constants.S1 * Math.sin(_0_Constants.ALPHA) ); } // Bestimmt den Winkel Theta der Umrissellipse protected double umrissTheta(double _phi) { return Math.atan( -_0_Constants.S1 * Math.cos(_0_Constants.ALPHA) * Math.cos(_phi) ); } // Skalarprodukt public double skalarprodukt(double[][] _vektor1, double[][] _vektor2){ double skalar = 0; for (int i = 0; i < _vektor1.length; i++) { skalar += _vektor1[i][0] * _vektor2[i][0]; } return skalar; } // Betrag eines Vektors public double betrag(double[][] _vektor1){ double betrag = Math.sqrt(Math.pow(_vektor1[0][0], 2) + Math.pow(_vektor1[1][0], 2) + Math.pow(_vektor1[2][0], 2)); return betrag; } // Kreuzprodukt public double[][] kreuzprodukt(double[][] _vektor1, double[][] _vektor2){ double[][] kreuz = new double[][] { {(_vektor1[1][0] * _vektor2[2][0]) - (_vektor1[2][0] * _vektor2[1][0])}, {(_vektor1[2][0] * _vektor2[0][0]) - (_vektor1[0][0] * _vektor2[2][0])}, {(_vektor1[0][0] * _vektor2[1][0]) - (_vektor1[1][0] * _vektor2[0][0])} }; return kreuz; } }